To the question. I'm trying to use the most basic forms. But I'm having trouble with REQUEST_METHOD; every time I try to compare it POST, it doesn't match, and I"m not sure why, any ideas?
He is the code I am using.
Code: Select all
<?php
function printForm()
{
// btw, userForm.php is the name of the file, is there a way to fetch the name of the file,
// so I don't have to hard code the name of the file into the code?
echo '
<!-- form start -->
<form action="userForm.php" method="POST" >
<fieldset>
<legend>Define your search:</legend>
<p><b>Name:</b> <input type="text" name="user_name" size="20" maxlength="40" /></p>
<div align="center"><input type="submit" name="submit" value="Find" /></div>
</form>
<!-- form end -->
';
}
if ( $REQUEST_METHOD == 'GET' )
{
printForm();
}
else if ( REQUEST_METHOD == 'POST' )
{
// responce to form
}
else
{
echo 'Error, invalid REQUEST_METHOD, \'', $REQUEST_METHOD, '\'';
printForm();
}
?>