Originally posted by dirtgreg
I have a form:
<html>
<form method="get" action="action.php">
Enter Your Name: <input type="text" name="yourname">
<br><br>
<input type="submit" name="Submit" value="Submit">
</form>
</html>
action.php:
<?php
echo($yourname);
?>
Instead of printing out the name, I always get an error saying yourname is undefined. Im running PHP 4.3.2 CGI/FastCGI on Windows XP pro / IIS. Im stumped, can anyone tell me why this doesnt work?
instead of that... try this....
<html>
<form method="get" action="action.php">
Enter Your Name: <input type="text" name="yourname">
<br><br>
<input type="submit" name="Submit" value="Submit">
</form>
</html>
action.php:
<?php
echo $_GET['yourname'];
?>
In later versions of PHP, GLOBALS is turned off by default, so your GET and POST vars arent accessible via $varname by default anymore..
also note that I would suggest using POST as your method, then you would access the variable using $_POST['yourname']