<!DOCTYPE html> <html> <head>
<?php include 'css.htm';?>
</head>
<body>
<?php
$pageName = basename($_SERVER['PHP_SELF']); /* Returns The Current PHP File Name */ echo "<h3> " . $pageName . "</h3> "; echo " <a href='../my-php/read_code.php?file=" . $pageName . "' target='_blank'> View Code </a>";
?>
<table background="images/bg.png" style="width:98%">
<tr> <td style="width:20%"> <br>Click on the links in the menu for more PHP examples.<br>
<?php include 'menu.php';?>
</td> <td height="95%" bgcolor="white" style="vertical-align:top"> <h2>PHP Notes</h2> <b>- Submit a form </b> <p>Here are 2 examples of HTML forms, GET and POST.<br> <br> </p> <table padding="15"> <tr> <td style="vertical-align:top"> Submit using the GET method<br> <hr style="height:2px;border-width:0;color:gray;background-color:gray"><br> <form action="form_submit.php" id="GET_method" method="get"> <input type="hidden" name="form_method" value="GET"> <label for="fname">Enter your first name:</label> <input type="text" id="fname" name="fname" autofocus><br><br> <input type="submit" value="Submit"> </form><br> <br><h2> <?php //Using GET, POST or COOKIE. $formType = $_REQUEST['form_method']; $fName = $_REQUEST['fname']; if ($formType == "GET") { echo "GET method used. Thanks " . $fName . "!"; } else { echo " "; } ?> </h2> <br> The form submit GET method sends input data to another page or to itself. The input data is attached behind the page URL, and <b>is visible</b> in the browser's address text box.<p> Sample HTML used to create this GET method form:<br> <img src="images/form_get.jpg" alt="HTML sample Form submit GET method"> </p> </td> <td style="vertical-align:top"> Submit using the POST method <br> <hr style="height:2px;border-width:0;color:gray;background-color:gray"><br> <form action="form_submit.php" id="POST_method" method="post"> <input type="hidden" name="form_method" value="POST"> <label for="fname">Enter your first name:</label> <input type="text" id="fname" name="fname"><br><br> <input type="submit" value="Submit"> </form><br> <br><h2> <?php //Using GET, POST or COOKIE. $formType = $_REQUEST['form_method']; $fName = $_REQUEST['fname']; if ($formType == "POST") { echo "POST method used. Thanks " . $fName . "!"; } else { echo " "; } ?> </h2> <br> The form submit POST method sends input data to another page or to itself. The input data is attached behind the page URL, but <b>is not visible</b> in the browser's address text box.<p> Sample HTML used to create this POST method form:<br> <img src="images/form_post.jpg" alt="HTML sample Form submit POST method"> </p> </td> </tr> </table> </td> </tr> </table>
</body> </html>
|