Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help Please!!!!!!!!!!!!!

Options
  • 07-10-2008 5:52pm
    #1
    Closed Accounts Posts: 368 ✭✭


    How come I can't get the code to continue after this?
    if (!$name){
    echo"No search term given.";
    echo $link;
    exit;
    }
    This is only it the field is blank, if not blank should continue.
    BUT it don't, but it is doing my head in.:)


Comments

  • Registered Users Posts: 338 ✭✭doubtfir3


    How come I can't get the code to continue after this?
    if (!$name){
    echo"No search term given.";
    echo $link;
    exit;
    }
    This is only it the field is blank, if not blank should continue.
    BUT it don't, but it is doing my head in.:)

    Have you defined $name above this?
    I presume you are posting from a form or something so it could be that.


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    doubtfir3 wrote: »
    Have you defined $name above this?
    I presume you are posting from a form or something so it could be that.

    $name is the field from this??

    <html>
    <head>
    <title>Search Result</title>
    </head>

    <body>
    <h2>Search for <br>
    </h2>
    <form action="resultByName.php" method="post">
    Please enter Details: <br>
    <input name="name" type="text">
    <br>
    <input name="submit" type= submit value="search">
    </form>
    </body>
    </html>


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Try
    [php]if ($_POST == '') {[/php]


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Webmonkey wrote: »
    Try
    [php]if ($_POST == '') {[/php]

    Yeeeeeeeeeeeeeeeeeeeeeeeeha

    YOU the MAN

    that worked i have worked on this for hours
    Once again i say
    YOU THE MAN

    and thank you.:D:D:D:D:D:D:D:D:D:D:D:D:D:D


  • Closed Accounts Posts: 368 ✭✭DrivingInfo


    Webmonkey would writing in dreamweaver make any difference to code


  • Advertisement
  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Didn't expect a thank you like that - thanks!

    Just to let you know, this may have worked in older versions of PHP but this was a security issue so they disabled global variables. So you will have to access POST, GET data via the $_POST or $_GET array. $_REQUEST catches both.

    Writing in Dreamweaver will make no difference what so ever. Its just an editor when coming to code - there are more advanced editors out there that may be better when writing PHP code. I've used PHP Designer a lot but it costs. Do a search here or google and you'll find free versions of software that may help or give you hints to syntax.


Advertisement