www.webdeveloper.com
Results 1 to 7 of 7

Thread: [RESOLVED] Search Form has me stymied

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    18

    resolved [RESOLVED] Search Form has me stymied

    I put a search box in the header of a website that I'm redesigning for a client - when you try to search, it doesn't "see" that you entered a query and sends you to a default search.php page with a search form in the middle of it. If I use this form in the body of the document - the search works great. Now, the coding for both forms (header and body) are the same. Has anyone ever encountered this and how would I fix it? (The site is using PHP and pulling from a MySQL database.) Also, if you use the header search form OR the search.php body search form - both take you to the same searchresults.php page.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    No idea without seeing the actual code. Maybe start by validating the HTML of the version that does not work? Also check the spelling (including capitalization) of all the form field attributes against what you are looking for in the $_GET or $_POST arrays in your PHP code.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Sep 2006
    Posts
    18
    The URL is http://www.americaninstrument.com/site - this is the "working" version of the new site so not all pages are there. Type in a query in the search box in the header (this box will be on all pages when the site is complete) - you will be directed to a Search page - which is not what should happen but does. Enter the same query into the box in the middle of the search page and you'll actually get results. The coding for both the search form in the header and the search form in the body of the search page are identical.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    I'm not seeing anything obviously different between the two forms.

    Pending someone else jumping in here with a revelation, one of my concerns would be whether or not any of the included javascript files affects things. Also, I'd look at correctly all these HTML errors in case any of them are somehow affecting the form and its fields in some way: http://validator.w3.org/check?verbos...e%2Fsearch.php
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Sep 2006
    Posts
    18
    Thank you so much for taking time to review this for me. I'll check the validation, but much of this is existing code from their current site (the robots.txt file is temporary because I don't want this site indexed while it's in development). My job is just to make it look nicer.

  6. #6
    Join Date
    Sep 2006
    Posts
    18
    I found the problem... seems that the input text field name was "search" and so was the search button. The original developer named the input field "search" and the button "Search" and I didn't catch the case change. Works fine now.

  7. #7
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Quote Originally Posted by mawells View Post
    I found the problem... seems that the input text field name was "search" and so was the search button. The original developer named the input field "search" and the button "Search" and I didn't catch the case change. Works fine now.
    As usual, it's the silly simple things that usually bite us in the butt.

    Please use the "mark thread resolved" option under the "thread tools" menu (assuming it is).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles