"Steven" <xu*****@attbi.com> wrote in message news:<jdSLa.62264$Fy6.16960@sccrnsc03>...
Hello,
I used a form to collect some data, and then use php script to verify the
data before send it to database. If the php script found some errors in
input data, it will use header(Location:register.php) to send it back to the
same form page.
Is there a way to keep those valid data and only ask user to input the data
with errors?
You can look at this example: agriya.com/demo/sendmore/signup.php
I will tell you the logic of the code....
<?php
//main.php
$var1=$var2="";//reset
if ($_POST)
{
if (form data is valid)
{
addformdata();
echo "success";
}
else
{
//fetch the values from $_POST....
$var1 = $_POST['var1'];
$var2 = $_POST['var2'];
include("template.php"); //show the template file
}
}
else //first time visit
include("template.php"); //show the template file
?>
<?php
//template.php
echo $var1;
echo $var2;
?>
In the template.php file, you actually will have the form stuff...
I have done it with class modules---it really saved lots of time.
HTH,
R. Rajesh Jeba Anbiah
---
"War kills you and me!"
Email: rrjanbiah-at-Y!com