Jump to content

PHP events


Elnof

Recommended Posts

Is there such a thing as events in PHP? I want to use the FILTER_VALIDATE_EMAIL when the user clicks 'submit', but the only way I can think to do that is:

...<input type="submit" onClick="<?PHP if (!filter_input(INPUT_GET, "email", FILTER_VALIDATE_EMAIL))  {  echo "Enter a valid E-mail";  } else  {  echo "Thank You!";  } }?>" />...

Would that work?

Link to comment
Share on other sites

No, you cannot run PHP code client-side, only on the server. If you want to do that, you need to use AJAX to send the email address to a PHP script which can check it and send a response back, or just submit the form and check the email on the next page like usual.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...