Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    25
    Thanks
    16
    Thanked 0 Times in 0 Posts

    How to specify url to let php do the search

    Currently, I am using a.html to call for b.php to search a mysql database and show the result. When people do the search, they input the term in the search box on a.html, and the showing url is www.mysite.com/b.php.

    How do I change the code so that people can simply use a url to do the search (without using the search box)? For example, if they input www.mysite.com/b.php?xx==bb, they will get the result for bb? The input name is currently '$search', and I tried www.mysite.com/b.php?$search=bb, it does not work.

    Thank you very much!

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Change the form method from `post` to `get`, and check for $_GET instead of $_POST.
    Last edited by kbluhm; 01-21-2011 at 05:04 PM. Reason: Typoed $_POST as $POST

  • Users who have thanked kbluhm for this post:

    toolglutton (01-21-2011)

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    25
    Thanks
    16
    Thanked 0 Times in 0 Posts
    Thank you very much, Sir.

    It works!

    Quote Originally Posted by kbluhm View Post
    Change the form method from `post` to `get`, and check for $_GET instead of $POST.
    Last edited by toolglutton; 01-21-2011 at 04:40 PM.


  •  

    Posting Permissions

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