SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: SEARCHING

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2000
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey,
    on my script, which searches through a tiny db, it doesn't submit the query if you press enter. YOu have to click the search button.
    Is there any way of stopping this? I know there is.. but what is it!
    Cheers!
    -aJ

    btw: the form is submitted with $PHP_SELF..
    cheers.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't submit or you can't detect $submit after someone hits enter. If this is the case try:

    Add a hidden input into the form with some name like

    <input type="hidden" name="issubmitted" value="1">


    then check for the
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also check to make sure the METHOD in the form is set - I don't know for sure if this makes a difference, but it might. Other than that I'd go with what Freddy said - I use hidden fields all the time.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chris,

    Just for your info, if you don't specify a method to your forms it defaults to GET. I suspect AJ's problem is that he has a page that submits to itself When the page first loads he has a form and then when he submits the form he checks for $submit

    Something like


    if ($submit) {
    //do something
    }

    <html>
    <head>
    </head>
    <body>
    <input type="text" name="searchwords">
    <input type="submit" name="submit" value="submit">
    </body>
    </html>

    When one presses enter, if they don'e have the submit button selected the variable $submit will not get passed in some cases.
    AJ:
    Try checking for $searchwords or what ever variable holds the search words instead of $submit or use my idea in my last post.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good point - I'd forgotten about that. I've had a few head-scratching sessions over that, ony to realize that simply pressing the button fixed the "problem" of sorts.

    Thanks for the info.


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
  •