HELP: Form and PHP

This is a discussion on HELP: Form and PHP within the PHP Language forums, part of the PHP Programming Forums category; Hello, I used a form to collect some data, and then use php script to verify the data before send ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-30-2003
Steven
 
Posts: n/a
Default HELP: Form and PHP

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?

Thanks
-Steven



Reply With Quote
  #2 (permalink)  
Old 06-30-2003
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: HELP: Form and PHP

"Steven" <xueming@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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:05 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0