SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: search by date

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2000
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    I am trying to add a form where you can enter a date and then it will search the database.
    I have it so that when you enter the date in the address bar it works fine:
    example:
    searchpage.php?dateentered=20011231
    that works fine...what I need help with is with the form to enter the date...
    I am trying to have a pull down for year, month, day and then add each together to get the result. I think I have to use something with '=.'
    Any help would be great.

  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)
    on search page make

    $dateentered = $yearvarfromform.$monthvarfromform.$dayvarfromform
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2000
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now how do I post it in the URL bar.
    Right now I have searchpage?year=2001&month=04&day=30
    How can I make it so that the search_page variable is used at the top?
    Thanks

  4. #4
    Rusted & Weathered HumanClay's Avatar
    Join Date
    Sep 2000
    Location
    Milwaukee, WI
    Posts
    225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't you just have

    searchpage.php?year=2001&month=04&day=30

    and then in your searchpage.php file, before you query the database, just combine $year, $month, and $day into the format you originally were asking for?
    Steve Caponetto - [profile] [e-mail]
    CreedFeed.com - feed your need for Creed!

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From what Freddy provided, try:

    ...
    $dateentered = $yearvarfromform.$monthvarfromform.$dayvarfromform
    header("Location:search.php?dateentered=$dateentered");

    It will do a redirection
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  6. #6
    SitePoint Zealot
    Join Date
    Oct 2000
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya...I guess I don't even have to have it in the URL bar do I?
    I am a little far off to be thinking like a programmer.
    Thanks!


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
  •