conker87 Posted June 10, 2010 Share Posted June 10, 2010 Hey guys. I'm reorganising my site, which also means I'm doing some mod_rewriting. Now that makes it all nice and pretty, but doesn't bode well for searches. I'm using a simple text box and button for this. However my search url is now: /search/<search> rather than ?search=<search> My question is, is there anyway using PHP to change the url the form submits to? Link to comment https://forums.phpfreaks.com/topic/204344-form-url-change-help/ Share on other sites More sharing options...
conker87 Posted June 10, 2010 Author Share Posted June 10, 2010 You know, come to think of it, this would probably be more Javascript's field. Google has bought up awfully complicated ways of doing this. Link to comment https://forums.phpfreaks.com/topic/204344-form-url-change-help/#findComment-1070169 Share on other sites More sharing options...
mrMarcus Posted June 10, 2010 Share Posted June 10, 2010 Assuming you created correct rewrite rules, you would still access the search term via $_GET['search'], no matter what the URL looks like. Link to comment https://forums.phpfreaks.com/topic/204344-form-url-change-help/#findComment-1070183 Share on other sites More sharing options...
conker87 Posted June 10, 2010 Author Share Posted June 10, 2010 Aye, I know. But I wanted to change where the search form submitted to. I did a little header redirection, I'm not sure if it's the best course of action, but ti works none the less. if (sanitise($_POST['search'])) header("Location: /search/" . sanitise($_POST['search'])); Link to comment https://forums.phpfreaks.com/topic/204344-form-url-change-help/#findComment-1070299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.