Record added twice?

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

Post Reply
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Record added twice?

Post by ianhull »

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();
?>
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

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

[SOLVED]

Post by ianhull »

I had my submit button on the previous page inside the form tage meaning it was submitted twice.

:oops:
ryanlwh
Forum Commoner
Posts: 84
Joined: Wed Sep 14, 2005 1:29 pm

Post by ryanlwh »

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.
Post Reply