mercredi 22 février 2017

if $_POST contains anything other than text do

I have a post data coming from a different page then this php code handles the data and saves it in a text file.

I want the data from $_POST['first'] to be saved if and only if its text ( doesnt contain a numbers or special characters)

<?php

$myfile = fopen("/var/things.txt", "a+");

$txt = "1st:".$_POST['first'];

fwrite($myfile, $txt);
fclose($myfile);

?>

Aucun commentaire:

Enregistrer un commentaire