With register_globals = on, passing the variables from a form is very easy, but i understand the security issues with global variables, and therefore do not wish to use them.
My question is what is the best way to code w/o global variables for forms?
Below is an example that works with register_globals = on:
<?php
// a.php
//how do i accomplish this without register_globals = on?
if (!isset($submit)) {
echo ("
<form action='a.php' method='post'>
<input type='text' name='foo'>
<input type='submit' name='submit' value='Submit'>
</form>
");
}
else {
echo ("
You entered ''$foo''.
<form action=javascript:history.back(-1);>
<input type=submit value=back>
</form>
");
}
?>
I've read the posts here regarding $POST, but it seems they are for individual fields ($POST["form_text_box_name"]), what about the entire form?
I'm running Apache 2.0.43 with PHP 4.2.3 on Win XP Pro, SP1.
Any comments are welcome. Thank you.