...

View Full Version : possible URL redirect?



Jason
03-11-2003, 12:55 AM
Ok, is it possible to do a redirect of the URL using PHP or do I have to use JavaScript?

Jason

whitty
03-11-2003, 01:05 AM
You should be more specific. What exactly are you trying to do?
The reason I say is that you can just use a meta tag to forward a page to a new one.


http-equiv="refresh" content="5;URL=http://www.yoursite.com"


Where 5 is the time in seconds you wish the page to be displayed.

ASAAKI
03-11-2003, 01:07 AM
<?php
header("Location: http://www.whatever_site.com");
?>

Jason
03-11-2003, 01:16 AM
well, I asked a similar question in the JavaScript section but here goes. I have a link you my page which is dynamic so its something like www.codingforums.com?date=20020310 for example. Where the int $date changes based on a date the user chooses. Well, the user gets to the page and is given some options. They click the appropriate check boxes and then the submit button. After the submit button I want to take the values from the check boxes and insert them into a DB with the date. However the date in the URL is erased and the page refreshes so its not there after the submit button is hit. So I want the URL to be unchanged. or go back to its original state with the ....date=20020310 at the end. So I thought a redirect would be appropriate.

Jason

ASAAKI
03-11-2003, 01:47 AM
how about using hidden input?
like u can put something like this on the form with the checkboxes:


<?php
echo("<input type='hidden' name='vanishingdate' value='".$_GET['date_from_prev_page']."'>");
?>
<input type='submit' value='go get it!'>


then when the form is submitted, vanishingdate=20030310 will be appended to the query string, and the on the next page you can access the date like so:

$thedate=$_GET['vanishingdate'];

might help might not, not sure i got ur question.
g'luck:)

Jason
03-11-2003, 02:16 AM
thanks, that worked...I didn't really want to do it that way, but it works.

oh btw, it wasn't $_GET it was $_POST to get the variable name.


Jason



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum