Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/170705-php-page-forward-with-a-form/
Share on other sites

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.

<?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-

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.