SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: PHP Diagnosis

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    Perth W.A.
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Diagnosis

    Can someone help please with my script, Its not working and I have no idea why.

    Any help appreciated

    Colin

    http://gordondesign.com.au/testing.php

    Associated php script is 'myscript.php' as follows;

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <?php

    $a = lowbudget;
    $b = Highbudget;

    if($a > $b) {
    echo 'SORRY! the 'under $500 budget' field should contain less than the 'over $500 budget' field ';
    }
    else {
    echo 'THANK YOU your information has been sent to our office';
    }

    ?>



    </body>
    </html>

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Fort Lauderdale
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lowbudget / highbudget variables should start with $

    you have to either escape your single quotes \' or use double quotes for the echo statement like this:
    Code:
    echo "SORRY! the 'under $500 budget' field should contain less than the 'over $500 budget' field";

    www.unpossiblemedia.com - A Fort Lauderdale based multimedia company.

  3. #3
    SitePoint Zealot Egghead's Avatar
    Join Date
    Feb 2002
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is also probably a good idea to escape the dollar sign when you want it echoed within double quotes. Your echo statement options:
    echo "SORRY! the 'under \$500 budget' field should contain less than the 'over \$500 budget' field";
    OR within single quotes, escape the 's only...
    echo 'SORRY! the \'under $500 budget\' field should contain less than the \'over $500 budget\' field';


Bookmarks

Posting Permissions

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