View Full Version : Syntax error using php page

07-28-2012, 10:03 AM


3) DESCRIPTION: Error recurring

4) URL TO CODE: localhost

or, ATTACHED BELOW (see #3 in guidelines below):

if{$_get {"page"} == "header"};

an you tell me where the syntax error is please?

If required I will submit my email for a response.

07-28-2012, 10:11 AM
This was posted in the wrong section. This is not a script submission; it is a question about PHP. It has been moved to the PHP section.

There are at least three errors:
1) An if statement does not end with a semi-colon, so you should remove that.
2) If statements use (), not {}.
3) Arrays use [] for indices, not {}; indices must not be separated by a space; $_GET is in caps and I believe it is case sensitive.
[4) I would also suggest using ' instead of " for indices and strings and in general-- it's faster-- use " only when you want to process PHP in it.]

With these changes we get:

if ($_GET['page'] == 'header')

That's the properly written version of the code.

Honestly, you should start with a basic introductory tutorial (there are many-- just do a search, or look through some of the older discussions here-- there are many links to decent tutorials) and you will become familiar with these things very quickly.