Schmoopy
01-10-2009, 02:32 PM
Hi there, I'm a complete novice to this, and may be a little bit out of my depth, but the problem I'm having seems pretty basic.
Basically, I have the following code which is part of a big page with lots of other HTML on it, so it jumps in and out of PHP:
<?php
$string = $_GET['email'];
if ($string == "invalid")
{
?>
The email you entered was invalid.
<?php
}
elseif ($string == "empty");
{
?>
You need to enter an email.
<?php
}
?>
When the user enters their email it gets sent to "subscribers.php" which performs some checks and then sends back the corresponding URL depending on the error.
That part works fine, but if the php sends back the "The email you entered was invalid", it executes the other if statement as well, but I don't know why, since it's an elseif. I did try "return false" at the end of it too but then stopped the rest of the page from running.
Any suggestions?
Thanks,
Jack
P.S - Can't link to the site where this is at to give you a demo because it's passworded but if you need more information just say what you need.
Basically, I have the following code which is part of a big page with lots of other HTML on it, so it jumps in and out of PHP:
<?php
$string = $_GET['email'];
if ($string == "invalid")
{
?>
The email you entered was invalid.
<?php
}
elseif ($string == "empty");
{
?>
You need to enter an email.
<?php
}
?>
When the user enters their email it gets sent to "subscribers.php" which performs some checks and then sends back the corresponding URL depending on the error.
That part works fine, but if the php sends back the "The email you entered was invalid", it executes the other if statement as well, but I don't know why, since it's an elseif. I did try "return false" at the end of it too but then stopped the rest of the page from running.
Any suggestions?
Thanks,
Jack
P.S - Can't link to the site where this is at to give you a demo because it's passworded but if you need more information just say what you need.