View Full Version : if else parse error

05-05-2004, 06:25 AM
I'm finally taking the plunge into php, but I've come across this error that won't go away... I've searched, I've read my only printed resource (Sam's PHP in 24 hrs) and I'm stuck.

//this is up top
<? php $page = $_GET['cat']; ?>

//then this down further
<? php if ( $page == "css" ) {
print "Cascading Style Sheets";
} else if ( $page == "code" ) {
print "Code";
} else { print "Everyone's Web" } ?>

It's seriously simple, but I keep getting a parse error on the first line of the second part. I've tried different quoting (single vs. double) and a few other wild guesses, but to no avail.

Baffled by simplicity,

05-05-2004, 06:39 AM
2 things,
there shouldn't be a space in <? php, it should be <?php
second thing, there was no semicolon on the last line.

try this

<?php $page = $_GET['cat'];?>

<?php if ( $page == "css" ) {
print "Cascading Style Sheets";
} else if ( $page == "code" ) {
print "Code";
} else { print "Everyone's Web"; } ?>

05-05-2004, 07:11 AM
Nice one bruva :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum