vendredi 27 mars 2015

In PHP how can I detect when a user is deleting text from an input text field


<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input type="text" name="phonenumber" value="" />
<form>


If there is something written in the input text field and the user start to delete the string meaning the last letter of the string I want to do something.


So something like this:



if(user deletes last letter of isset($_POST['phonenumber'])){
//do something
}


I tried to use strlen() with -1 but did not seem to work. Anyone have any ideas?


Thank you!


Aucun commentaire:

Enregistrer un commentaire