Do it all in one file, for example parse_my_form.php:
<?php
$str_name = !empty($_POST['name']) ? $_POST['name'] : "";
$str_age = !empty($_POST['age']) ? $_POST['age'] : "";
$str_error = "";
if($str_name == "" or $str_age == "")
$str_error = "<p>Error parsing form</p>";
else
header("Location: http://mywebsite.com/form_submission_ok.php");
?>
<html>
<head>
<title>Fill in the boxes!</title>
</head>
<body>
<?php echo $str_error ?>
<form name="form1" action="parse_my_form.php" method="post">
<input name="name" type="text">
<input name="age" type="text">
<input type="submit">
</form>
</body>
</html>
"php newbie" <ne**********@yahoo.com> wrote in message
news:12**************************@posting.google.c om...
Hello,
I am learning php. I have created a simple Web page with a form.
After receing the POST request, I do some error checking. In case of
errors, I would like to re-post the page, but with the current values
for each field.
I have organized my files like this:
1) Webpage with the form (all in html, form action points to a php
file)
2) php file that receives the request.
Is there a simple way to accomplish this?