Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

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

  • 07-10-2008 05: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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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
Advertisement