Jump to content

PHP redirect


jjmusicpro

Recommended Posts

For some reason, i cant seem to post values, so the page i am sending the person to wont grab the values i posted.

 

on my main page, i have this code.

 

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
$site = $row['redirect_url'] ;
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site\">";
}

 

Then on my recieving page i have this:

 

 

<?php $searchsomewhere = $_POST['zipcode_entered_search']; echo $searchsomewhere; ?>

 

 

It just wont post the values.

Link to comment
Share on other sites

Maybe I'm missing something but what exactly are you trying to do here?  A redirect is not going to post vars over with it.  This is not how you do a post.  You basically have 2 ways to deal with this as far as I know.

 

1) You can do a form post event to hook a post page to a button which automatically will send over your fields, or you can pass things over with a normal html link and pass the fields as query strings.

 

<form name="Login" method="post" action="index.php">

<input type="submit"  value="<?=$lang[ "LoginButton" ]; ?>" onclick="" id="btn_Login" />

</form>

 

Or query string:

--a href="http://www.mydomain.com/index.php?var1="hello">click me</a>

 

Hope that helps...

 

 

Link to comment
Share on other sites

What i am doing is..

 

 

The user goes to the main page, and enters a zipcode, then 3 things can happen...

 

if a result is found, only 1, it will redirect them to a new url in the database

 

if 2 results, it will loop through results

 

if 0 results, then it will redirect them to a page i am now where it needs to post the zipcode entered in a string like "we couldnt find your xxxxxx zip, please...."

Link to comment
Share on other sites

Well, honestly I don't believe I'd be going to all that trouble.  I think it might be a bit easier if you actually have a single page that does all of that.  Enter the zipcode, post back to the same page where you have a couple if statements.  If you have a post back var $_POST[... then you do one thing and display your need to enter more info, or found it and moving on, or found more than 1 please choose.  Doing redirects is not what you want to be doing because they don't carry over fields.  You are basically telling the server that you don't want to be here so please go there.  Nothing goes along with you.

 

hope that helps,

 

 

Link to comment
Share on other sites

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.