...

View Full Version : double insert



the-dream
08-18-2007, 04:27 PM
i dont know why but my script is inserting the record then a blank record. i dont know why, please help


<?php

include("connect.php");
$feedname = $_POST['feedname'];
$feedurl = $_POST['feedurl'];

$query = "INSERT INTO feeds (id, feedname, feedurl)
VALUES ('', '$feedname', '$feedurl')";

$results = mysql_query($query) or die
("Could not execute query : $query." . mysql_error());

if ($results)
{
echo "Details added.";
}
mysql_close();
?>

abduraooft
08-18-2007, 04:42 PM
Are you using a javascript submit() function call from an input having type="submit" ?

the-dream
08-18-2007, 06:03 PM
this is the form code:


<form id="FormName" action="addFeed.php" method="post" name="FormName">
<table width="448" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width = "150">
<div align="right">
<label for="feedname">feedname</label>
</div>
</td>
<td>
<input id="feedname" name="feedname" type="text" size="25" value="" maxlength="255">
</td>
</tr>
<tr>
<td width = "150">
<div align="right">
<label for="feedurl">feedurl</label>
</div>
</td>
<td>
<input id="feedurl" name="feedurl" type="text" size="25" value="" maxlength="255">
</td>
</tr>
<tr>
<td width="150">
</td>
<td>
<input type="submit" name="submitButtonName" value="Add">
</td>
</tr>
</table>
</form>

CFMaBiSmAd
08-18-2007, 07:34 PM
Is the form and the php form processing code in the same file? If so, show that whole file so that the program flow can be seen.

Also, are you doing any url rewriting in a .htaccess file or are you doing any redirecting?

the-dream
08-19-2007, 02:07 PM
Different files, no redirect, no .htaccess



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum