Starting PHP |
|
2024-12-23 |
|
|
8 |
|
|
Traditional Form Handling
<form action="<?=$PHP_SELF?>" method="POST">
Your name: <input type=text name=name><br>
You age: <input type=text name=age><br>
<input type=submit>
</form>
Output
Receiving Script
Hi <?echo htmlspeciachars($name); ?>.
You are <?echo (int)$age?> years old.
Register Globals
Some feel that automatically populating the symbol table with user-supplied data can lead
to insecure programs, which to some extent is correct. To combat this the
register_globals setting is off by default in PHP 4.2 and later.
Hi <?echo htmlspeciachars($_POST['name']) ?>.
You are <?echo (int)$_POST['age'] ?> years old.