Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2011, 03:16 PM   PM User | #1
toolglutton
New Coder

 
Join Date: Dec 2010
Posts: 25
Thanks: 16
Thanked 0 Times in 0 Posts
toolglutton is an unknown quantity at this point
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!
toolglutton is offline   Reply With Quote
Old 01-21-2011, 03:26 PM   PM User | #2
kbluhm
Senior Coder

 
kbluhm's Avatar
 
Join Date: Apr 2007
Location: Philadelphia, PA, USA
Posts: 1,502
Thanks: 2
Thanked 258 Times in 254 Posts
kbluhm will become famous soon enough
Change the form method from `post` to `get`, and check for $_GET instead of $_POST.
__________________
ZCE

Last edited by kbluhm; 01-21-2011 at 04:04 PM.. Reason: Typoed $_POST as $POST
kbluhm is offline   Reply With Quote
Users who have thanked kbluhm for this post:
toolglutton (01-21-2011)
Old 01-21-2011, 03:32 PM   PM User | #3
toolglutton
New Coder

 
Join Date: Dec 2010
Posts: 25
Thanks: 16
Thanked 0 Times in 0 Posts
toolglutton is an unknown quantity at this point
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 03:40 PM..
toolglutton is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:10 PM.


Advertisement
Log in to turn off these ads.