Results 1 to 2 of 2

Thread: Syntax error using php page

  1. #1
    Join Date
    Jul 2012
    Thanked 0 Times in 0 Posts

    Question Syntax error using php page

    1) CODE TITLE: PHP-Errors


    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.

  2. #2
    Join Date
    Mar 2006
    Illinois, USA
    Thanked 690 Times in 678 Posts


    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:
    PHP Code:
    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts