?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?simple filled in form
Author:??(203.161.228.---)
Date:???04-29-04 19:01

i try to make a form for ppl filling in. after i click submit, the form detail will show in the same page.but when i refresh the page, the same detail that just be filled in by the last client will be added to database again. and make the same detail duplicated in database. what is the solution that i can avoid this thing happened??


if ( $_GET["op"] == "reg" ) {
mysql_select_db($database_db, $db);
$name = $_POST ["Name"] ;
$buysell = $_POST ["BuySell"] ;
$currency = $_POST ["Currency"] ;
$price = $_POST ["Price"] ;
$reason = $_POST ["Reason"] ;

$date = date("Y-m-d H:i:s") ;
$sql = "INSERT INTO buysell ( Date, Name, BuySell , Currency , Price, Reason )".
"VALUES ( '$date' , '$name' , '$buysell' , '$currency' , '$price' , '$reason' ) " ;


$result=mysql_query($sql);

Header("Location: form.php?op=thanks");
echo " your information is successully added. thanks
";
}
else
{
die ("fail to add information !");


mysql_close($db);
}

?>

?Re: simple filled in form
Author:??(---.cpe.net.cable.roger)
Date:???04-29-04 20:29

turn caching off

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum