Icarus050 Posted April 4, 2008 Share Posted April 4, 2008 Hello, I'm sure this is a simple enough request, but my noob flag is flapping all over the place so I have no idea how to implement the scripts I've found I want to have people be able to modify two aspects of an existing search string via a web based form. The gist of the URL I'm looking to generate is: /Search/Results.html?Query=Queue = 'My Queue' AND Status != 'resolved' AND Content LIKE 'smith' AND Subject LIKE 'application' &Rows=50 I want the 'application' part to be able to be changed via a dropdown with three options (application, configuration and task) and the 'smith' to be based off a text entry. I don't have a great deal of access to the back end so I'm really looking for something in page to complete the task. Cheers. Ic. Link to comment https://forums.phpfreaks.com/topic/99479-generate-url-from-form-input/ Share on other sites More sharing options...
doni49 Posted April 4, 2008 Share Posted April 4, 2008 <form mode=get action=/Search/Results.html> <input type=checkbox name=Status> <input type=hidden name=Queue value="My Queue"> <select name=task> <option value="application">Application</option> <option value="configuration">Configuration</option> <option value="task">Task</option> </select> <input type=text name="Content"> <input type=text name="Subject"> <input type=submit name=submit> <input type=reset name="reset"> </form> Here's a form--try it and see what kind of URL it generates. To retrieve the values, use the $_GET array: $subject = $_GET['Subject']; Link to comment https://forums.phpfreaks.com/topic/99479-generate-url-from-form-input/#findComment-508985 Share on other sites More sharing options...
Icarus050 Posted April 4, 2008 Author Share Posted April 4, 2008 Generates a URL but it leaves out all the AND and LIKE entries and adds a bunch of '=' and '&' where there shouldn't be.. /Search/Results.html?Queue=My+Queue&task=application&Content=Smith&Subject=2nd+field&submit=Submit+Query Link to comment https://forums.phpfreaks.com/topic/99479-generate-url-from-form-input/#findComment-508993 Share on other sites More sharing options...
doni49 Posted April 4, 2008 Share Posted April 4, 2008 That's the way forms work. Take this info and build the query. The & tells php that a new variable is coming. The equals sign tells php what the value of the preceding variable is. Link to comment https://forums.phpfreaks.com/topic/99479-generate-url-from-form-input/#findComment-508997 Share on other sites More sharing options...
Icarus050 Posted April 4, 2008 Author Share Posted April 4, 2008 Ahuh.. see, all the words are in English, and yet the meaning is flying right by me.. I have zero experience with PHP, all I know is I can use it on the site I'm playing with.. you're gonna have to nurse me through it a lot more. Link to comment https://forums.phpfreaks.com/topic/99479-generate-url-from-form-input/#findComment-509001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.