vynsane Posted June 17, 2007 Share Posted June 17, 2007 hi, all... i'm wondering if there's a way to send $_GET variables to a page in the same form as the mod_rewrite rules that i'm using. for example, this page: http://invincible.comics-database.com/database/comicsByReleaseDate/01-2006 is really this: http://invincible.comics-database.com/database/comicsByReleaseDate.php?month=01&year=2006 the form is on this page (under "search by release date"): http://invincible.comics-database.com/database/ the form sends one select as the month and one select as the year. basically the question is: how can i take $_GET variables coming from that form ("month=01" and "year=2006") and turn it into the mod-rewrite emulated folder structure ("/01-2006")? is there a mod_rewrite that can be done, or would i have to pass it through another script that transforms the $_GETs into the form i need and then redirect it to the proper version of the URL? Link to comment https://forums.phpfreaks.com/topic/55946-solved-_get-variables-from-form-and-mod_rewrite-transform-into-directory-structure/ Share on other sites More sharing options...
vynsane Posted June 19, 2007 Author Share Posted June 19, 2007 is there a mod_rewrite that can be done, or would i have to pass it through another script that transforms the $_GETs into the form i need and then redirect it to the proper version of the URL? just FYI, i solved my own problem at the end of my post - that's what i did - i turned the forms into POST instead of GET and created a passthrough script that redirects to the correct URL. it's actually a cool little technique and i made it a multi-purpose page so at the moment 5 different forms are using the passthrough. Link to comment https://forums.phpfreaks.com/topic/55946-solved-_get-variables-from-form-and-mod_rewrite-transform-into-directory-structure/#findComment-277647 Share on other sites More sharing options...
sKunKbad Posted July 10, 2007 Share Posted July 10, 2007 Do you mind posting your passthru script, I need to do the same exact thing right now. Does anybody know if this is the best way of doing this? Link to comment https://forums.phpfreaks.com/topic/55946-solved-_get-variables-from-form-and-mod_rewrite-transform-into-directory-structure/#findComment-294478 Share on other sites More sharing options...
Carterhost Posted July 10, 2007 Share Posted July 10, 2007 Quick and Dirrty: redirect.php: <?php $year = $_GET['year']; $month = $_GET['month']; $url = "http://invincible.comics-database.com/database/comicsByReleaseDate/".$month."-".$year; header('Location:'.$url); ?> Use this as the whole page. You should expand on it to do some input checking on your $_GET variables, but this should basically be it. Remember, no spaces or HTML before this code or you'll get the dreaded "Headers already sent" Error. Link to comment https://forums.phpfreaks.com/topic/55946-solved-_get-variables-from-form-and-mod_rewrite-transform-into-directory-structure/#findComment-294560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.