|
Posted by d on 02/15/06 01:38
"tmax" <tmax@comcast.net> wrote in message
news:1f9bd$43f23b15$481a8e8e$29885@PGTV.COM...
> Well, I've tried everything that has been suggested so far - thanks for
> everyone's input.
>
> However, let me restate the problems differently as I believe it wasn't
> correct to begin with.
I understand completely what you're asking :)
Try this code:
<?
session_start();
if (isset($_POST["data"])) {
$_SESSION["data"]=$_POST["data"];
session_write_close();
header("Location: ".$_SERVER["SCRIPT_URI"]);
exit();
}
if (isset($_SESSION["data"])) {
?>
<html>
<head><title>Thanks!</title></head>
<body>
Thank you for submitting your data:<br>
<?=$_SESSION["data"];?>
</body>
</html>
<?
} else {
?>
<html>
<head><title>Please Submit</title></head>
<body>
Use the form to submit your data:<br>
<form method="post">
<input type="text" name="data"><br>
<input type="submit" value="Go!">
</form>
</body>
</html>
<?
}
?>
It will show a form, and take that posted data and store it in a session.
Then, the script re-directs you back to itself, and that redirection stops
your browser wanting to resubmit the data when refreshed. The session is
then checked, and if the data is present, a thank-you note is displayed. If
not, it then shows the initial form.
dave
Navigation:
[Reply to this message]
|