Entry
PHP Newbie: HTML form calls PHP file, unable to access Html form variables in php; please help?
Dec 3rd, 2004 09:39
Andrew Figula, Mark Wright, B Harris,
Whenever you submit a form to a a php script then the values submitted
by that form are available to you as variables with then name of the
variables being the name of the form fields.
For example if you have a form that has two fields - one called name
and the other email then the php script will be able to access a
variable called $name and one called $email. The values of these two
fields will be the same as the user entered.
Unless you are running on php 4.1 or higher. If so, you must use
$myvar=$_GET[$myvar] if Get is the method of the form,
if its not you can use $myvar=$_POST[$myvar] where $myvar is the name
of the field in form eg."<input type=text name=myvar>. there can be
some notice's displayed but the variables will be restored. You can
avoid this by setting error_reporting(0) or something :)