Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: SV: Posting Variables On Redirect


Message #1 by "Datatal AB - Gauffin, Jonas" <jonas@d...> on Wed, 20 Nov 2002 08:26:13 +0100
Why don't you post to your original page?

<?php
	if (isset($_QUERY['action']) && $_GET['action'] =3D=3D 'submit')
	{
		if (submit_ok($_POST['name']))
		{
			//Submit the data
			Header('Location: thanksfordata.php');
		}
		else
		{
			$errormsg =3D 'Enter your name..';
		}
	}
?>
<html>
[blablabla...]
<?php if (isset($errormsg)) echo $errormsg; ?>
<form method=3Dpost action=3D'thispage.php?action=3Dsubmit'>
<input type=3Dtext name=3D"name" value=3D"<?php if 
(isset($_QUERY['name'])) echo $_POST['name']; ?>">
<input type=3Dsubmit>
</form>


-----Ursprungligt meddelande-----
Fr=E5n: Mark Carruth [mailto:mcarruth@t...]
Skickat: den 19 november 2002 20:27
Till: professional php
=C4mne: [pro_php] Posting Variables On Redirect


I have a problem in that, if the user submits a form, and for example
there is a problem with the input, I need to redirect them back to the
old page, but, I also want to post the variables they entered back to
the page in the form of a post header.

Obviously, the redirect is conducted thus:

header("Location: somepage.php");

I am presuming, that to post these variables I can simply post another
head with the required information. Does anyone know (1) if this is a
possible and (2) how they might go about doing it?

Thanks in Advance,

------------------
Mark Carruth





  Return to Index