SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form submission problem

    I have a submission form for a realty listings search engine. There is a field called "minprice" and "maxprice" and a bunch of others. Now the problem is that if I have those min/maxprice variables as <input type=text>, the search works fine however if I change them to a <select>, the search no longer works.

    If I leave it as a <select> statement, even blank entries get appended to the address.

    ie:
    browse.php?minprice=0&maxprice=0&sqfeet=2000

    But if I have use <input type=text> to input the min/maxprice, the address does not get appended:

    browse.php?sqfeet=2000

    I would like to use a <select> as it cuts down on any possible misentry of text.

    Any suggestions are appreciated!

    Thanks.
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net

  2. #2
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just in the script that processes the requests do this:


    instead of letting it freak out about getting '0' for max/min price just accomodate for that.

    ie:

    PHP Code:

    if($maxprice=0) {

    $use_maxprice_in_sql false

    }else{

    $use_maxprice_in_sql true



    and then compile your SQL query with that idea in mind (ie test to see if you use the max/min price and then add it to the sql query.)



    Luck to you!
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  3. #3
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Slight update

    == and ;'s

  4. #4
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Slight update

    Originally posted by Anarchos
    == and ;'s

    Good thing you'r around to catch my little errors
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  5. #5
    SitePoint Addict
    Join Date
    Sep 2000
    Location
    Ontario, Canada
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For some reason, min/maxprice automatically get added to the query that gets passed to the search script.

    The <input type> and <select> formats seem to differ in that if you have the select=0, it still gets appended to the query because the 0 is data.
    Jason Dulberg
    Extreme MTB
    http://extreme.nas.net


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
  •