Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if else crashes script

Status
Not open for further replies.

yamy

Technical User
Nov 22, 2002
54
US
this bit of scripting crashes the page when i add it into the existing php scripted page that is handling the form data from another page.

// checks for a set radio button and assigns the value to a variable (or NULL)

if (isset($_REQUEST['gender'])) {
$gender = $_REQUEST['gender'];
} else {
$gender = NULL;
}

//print a message based on the gender value

if ($gender == 'm') {
echo '<p>good day,
sir</p>';
}elseif ($gender == 'f') {
echo '<p>good day,
miss</p>';
} else }
echo '<p>please select
a gender</p>';
}

I've looked at this for an hour now, fixed a typo here and there. i tried double quotes on the echo statement, but still cannot get it to play nice.

this new snippet is inside the <?php ?> tags,
the variable assignment is in line with the other variable assigns;
the echo request follows another echo request that functioned fine before this was added.

any ideas?

thanks
yamy
 
i knew it was going to be that simple. i've just been looking at it for too long.

thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top