COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
<BODY>
<h4>Form variable</h4>
<form action=ex7.php method=post>
<table>
<tr><td>User Name</td>
<td>
:<input type=text name=username>
</td></tr>
<tr><td>Password</td>
<td>
:<input type=password name=password>
</td></tr>
<tr><td> </td>
<td><input type=submit value=Login></td></tr>
</table>
</form>
</BODY>
</HTML>
Khi ngöôøi söû duïng nhaäp username vaø password nhö hình 4-6 vaø nhaán nuùt Login.
Hình 4-6: Ñaêng nhaäp
Baèng caùch söû duïng $HTTP_POST_VARS ñeå laáy giaù trò username vaø password nhö ví duï
4-7.
Ví duï 4-5: Söû duïng $HTTP_POST_VARS
<HTML>
<HEAD>
<TITLE>::Welcome to PHP</TITLE>
</HEAD>
<BODY>
<h4>Form variable</h4>
<?php
if(isset($HTTP_POST_VARS["username"]))
{
?>
Giaùo vieân: Phaïm Höõu Khang