Home >> General Creasting Dynamic Web Sites 3.2 [Page 1] Article by: Shelton Manage Sunday, 14th June, 2009
Handling HTML Forms with PHP Redux
To ahave one page both display and handle a form, use a conditional.
if (/* form has been submited */) { // Handle it. } else { // Display it. }
To determine if the form has been submitted, I normally check if the $submit vriable is set (which is the name of the submit input type in the form).
if ( isset($_POST['submit'])) { // Handle it. } else { // Display it. echo ''; }
If you want a page to handle a form and then display it again use.
if (isset($_POST['submit'])) { // Handle it. } // Display it.
this page both displays and handles a registration form.
register.phps | register.php
Page: First - 1 2 3 4 5 - Last
|