PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Thu Sep 15, 2005 12:13 pm
Hi guys,
I am inserting some content into the db but is seems to be entered twice.
Anyone know why?
Code: Select all
<?php session_start();
include_once("connect.php");
$sletter = $_POST['letter'];
$title = $_POST['title'];
$details = $_POST['inpContent'];
$addedby = $_SESSION['username'];
$added = date('l dS \of F Y h:i:s A');
$insert = "INSERT INTO `procedures` (`Letter`, `Title`, `Details`, `Addedby`) VALUES ('$sletter', '$title', '$details', '$addedby') ";
mysql_query($insert) or die(mysql_error());
exit();
?>
shiznatix
DevNet Master
Posts: 2745 Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:
Post
by shiznatix » Thu Sep 15, 2005 12:41 pm
is the the entire code for the page? are you hitting submit twice?
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Thu Sep 15, 2005 12:42 pm
I had my submit button on the previous page inside the form tage meaning it was submitted twice.
ryanlwh
Forum Commoner
Posts: 84 Joined: Wed Sep 14, 2005 1:29 pm
Post
by ryanlwh » Thu Sep 15, 2005 1:38 pm
i don't see having a submit button on the previous page would make you submit this page twice, unless this page submits to itself again.