COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
<BODY>
<h4>Form variable</h4>
<table>
<tr><td>List by Alphabet</td></tr>
<tr><td>
<a href="ex3.php?al=A">A</a> |
<a href="ex3.php?al=B">B</a> |
<a href="ex3.php?al=C">C</a> |
<a href="ex3.php?al=D">D</a> |
<a href="ex3.php?al=E">E</a> |
<a href="ex3.php?al=">All</a>
</td></tr>
<?php
if(isset($HTTP_GET_VARS["al"]))
{
?>
<tr><td>Select:<?=$HTTP_GET_VARS["al"]?></td></tr>
<?php
}
?>
</table>
</BODY>
</HTML>
Keát quaû traû veà nhö hình 4-5.
Hình 4-5: Söû duïng $HTTP_GET_VARS
3.
PHÖÔNG THÖÙC $HTTP_POST_VARS
Töông töï nhö $HTTP_GET_VARS nhöng $HTTP_POST_VARS cho pheùp baïn laáy giaù trò
laáy töø caùc theû nhaäp lieäu cuûa theû form trong traang submit tröôùc ñoù. Ví duï, baïn khai baùo
trang nhaäp lieäu nhö ví duï 4-6.
Ví duï 4-5: Khai baùo form vôùi phöông thöùc POST
<HTML>
<HEAD>
<TITLE>::Welcome to PHP</TITLE>
</HEAD>
Giaùo vieân: Phaïm Höõu Khang