irongloves Posted April 5, 2014 Share Posted April 5, 2014 Hello, I have a website which is based on this script http://codecanyon.net/item/php-search-engine/4052196 You can see a demo here: http://searchengine.pricop.info/ What I'm trying to do is to find a way to pre-populate that search form on the homepage based on parameters in the url For example if I redirect somebody to http://searchengine.pricop.info/?boston-flights he should be redirected to the homepage of the website and the phrase "boston flights" should be already filled in the search form. Any idea on how to do that? Please note that the ?boston-flights parameter is just to give you an idea, I guess the syntax could be different as long as I can achieve the prepopulation of the form. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/287540-pre-populate-a-form-through-url-parameter/ Share on other sites More sharing options...
Rifts Posted April 5, 2014 Share Posted April 5, 2014 (edited) Well this is very simple you if had any basic php knowledge. You can send search params through the url for example hxtp://searchengine.pricop.info?city=boston-flights" You can then use php like so to grab that var $search = $_GET['city']; now in your form you can set the default value to $search for that input field. Edited April 5, 2014 by Rifts Quote Link to comment https://forums.phpfreaks.com/topic/287540-pre-populate-a-form-through-url-parameter/#findComment-1475083 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.