HTML Form Tag |
•
%form action="" method=*@If the input type is password, the letters will be shown as '*'. In order to avoid auto complete function, the input attribute "autocomplete" can be set as autocomplete="off".//* = POST, GET %input type=*@//* = text, password, checkbox, radio, image, hidden ... %input type="submit"@ %input type="reset"@
Let's see a form example:
Following is the Main HTML code:
<FORM name=tt action="<?PHP $_SERVER['PHP_SELF']?> " method="post"> <input name=n value='<?php echo "$n";?> ' style="font-size:16px; height:26px;width:250px">: Name<br><br> <input name=p value='<?php echo "$p";?> ' type=password style=" font-size:16px;height:26px;width:250px">: Password<br><br> <input name=e value='<?php echo "$e";?> ' style="font-size:16px; height:26px;width:250px">: E-Mail<br><br> <input type="submit" style="height:26px;width:80px" name="submit" value="Submit" /> </FORM><?PHP if ($flag == 0 && isset($_POST['submit']))echo "<br><br><font color=\"red\">form submit failed. </font>\n";else if ($flag == 1 && isset($_POST['submit'])) echo "<br><br><font color=\"red\">form submit success. </font>\n";?>
The PHP validation code in the beginning of the file:
<?PHP $flag =0; $n=""; $p=""; $e="";if (isset($_POST['submit'])) {if (isset($_POST['n'])) $n = $_POST['n'];if (isset($_POST['p'])) $p = $_POST['p'];if (isset($_POST['e'])) $e = $_POST['e'];if ($n=="" || $p=="" || $e=="") $flag=1; }?>
•