SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2003
    Location
    eez
    Posts
    331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to ignore to submit input="text" fields that are empty in GET forms?

    Hi!

    Let's say I a search form with the following input="text" fields (names): description, horse_color, buddy_snapshot.

    Suppose a user enters only a keyword in the description field.
    The resulting GET query will look like:
    description=something&horse_color=&buddy_snapshot=
    The red part is unnecessary.

    Is there some way of getting rid of it?

    thanx

  2. #2
    SitePoint Enthusiast plattopus's Avatar
    Join Date
    Aug 2002
    Location
    Melbourne, Australia
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not really... since you'd have to load a page with that query string in order to find out if the values are in fact empty, and then redirect to a page without those values in the URL. It adds another step and you still have to have the query string for the first step.

    You could send the form as POST variables, but I don't know if you have a legitimate reason for using GET.


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
  •