Travist6983 Posted August 17, 2009 Share Posted August 17, 2009 ok i am trying to create city pages such as birmingham.php that all it does is forward to the search result for birmingham we are a real estate company that is trying to get some better SEO with all our surrounding citys... our search results page land on listings.php i have done this to our footer of each page with this form action <form name="Birmingham" action="listings.php" method="post"> <input type="hidden" name="searchType" value="custom"> <input type="hidden" name="newSearch" value="true"> <input type="hidden" name="table" value="rs"> <input type="hidden" name="city" value="2192"> <input type="hidden" name="beforeListPrice" value="0"> <input type="hidden" name="afterListPrice" value="any"> <input type="hidden" name="featuredOnly" value="false"> </form> <a href="javascript:void[0];" onclick="document.forms['Birmingham'].submit(); return false;">Birmingham</a> is it possible to use this form action in like a PHP header forward? <?php header("location: javascript:void[0]; onclick="document.forms['Birmingham'].submit(); return false;""); ?> Any suggestions on this would be a great help Thank You Quote Link to comment https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/ Share on other sites More sharing options...
oni-kun Posted August 17, 2009 Share Posted August 17, 2009 Javascript is a CLIENT SIDE scripting language and cannot interact with PHP like this. You'd need to use this to redirect.. Birmingham.php: <?php header('Location: '.$_SERVER['SERVER_NAME'].'/seach.php?city=birmingham'); ?> Like so.. Which'll automatically redirect them. Quote Link to comment https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/#findComment-900314 Share on other sites More sharing options...
ignace Posted August 17, 2009 Share Posted August 17, 2009 <?php header("location: javascript:void[0]; onclick="document.forms['Birmingham'].submit(); return false;""); ?> No it isn't your headers can only be http response headers (http://www.w3.org/Protocols/HTTP/Object_Headers.html) or custom headers starting with X- Quote Link to comment https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/#findComment-900315 Share on other sites More sharing options...
ignace Posted August 17, 2009 Share Posted August 17, 2009 Javascript is a CLIENT SIDE scripting language and cannot interact with PHP like this. You'd need to use this to redirect.. Birmingham.php: <?php header('Location: '.$_SERVER['SERVER_NAME'].'/seach.php?city=birmingham'); ?> Like so.. Which'll automatically redirect them. Search engines don't like redirects. Quote Link to comment https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/#findComment-900318 Share on other sites More sharing options...
Travist6983 Posted August 17, 2009 Author Share Posted August 17, 2009 @oni-kun thank you thank you... i hadn't even thought of that that should work perfect thanks again Quote Link to comment https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/#findComment-900325 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.