annoying problem please help!!
Posted: Thu Feb 06, 2003 5:05 am
Hi all,
I am new to PHP, i have read about the problems encountered with the new PHP 4.2+. But i have a similar problem but running the old PHP 4.1.1.
When running similar code to this
<?php
// Form has been submitted...
if ( isset($_POST['submit']) ) {
if ( empty($_POST['emailAddress']) {
header("Location: emailOkay.php");
} else {
echo 'Email was not entered.';
}
}
?>
<form method="post" action="formTest.php">
Enter an Email: <input type="text" name="emailAddress" />
<input type="submit" name="submit" value="Submit Email Address" />
</form>
My computer ignores the if statements that check if the fields are empty, and posts regardless.
I have tried turning the global variables on and off but with no luck.
However if i leave the Form action empty i.e. "" the if statements that check for empty fields work!
Does anyone know what could be wrong,
thankyou for your time.
Jose
I am new to PHP, i have read about the problems encountered with the new PHP 4.2+. But i have a similar problem but running the old PHP 4.1.1.
When running similar code to this
<?php
// Form has been submitted...
if ( isset($_POST['submit']) ) {
if ( empty($_POST['emailAddress']) {
header("Location: emailOkay.php");
} else {
echo 'Email was not entered.';
}
}
?>
<form method="post" action="formTest.php">
Enter an Email: <input type="text" name="emailAddress" />
<input type="submit" name="submit" value="Submit Email Address" />
</form>
My computer ignores the if statements that check if the fields are empty, and posts regardless.
I have tried turning the global variables on and off but with no luck.
However if i leave the Form action empty i.e. "" the if statements that check for empty fields work!
Does anyone know what could be wrong,
thankyou for your time.
Jose