Hello,
Can anyone see why this piece of code is not working. Sometimes the page looks as if it is posting the data but nothing appears in the table "request" and then there are other times when i get "Notice: Undefined index: id"
Any suggestions??
Thanks
Martin
Can anyone see why this piece of code is not working. Sometimes the page looks as if it is posting the data but nothing appears in the table "request" and then there are other times when i get "Notice: Undefined index: id"
Any suggestions??
Code:
<?
if(isset($_POST['post'])) {
$name = $_POST['name'];
$id = $_POST['id'];
$SQL = " INSERT INTO request ";
$SQL = $SQL . " (name, type, requested_id, completed) VALUES ";
$SQL = $SQL . " ('$name', 'cd','$id','no') ";
$result = mysql_db_query($db,"$SQL",$cid);
echo ("$name");
if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); }
}
if(isset($_POST['post'])) {$id = $_POST['id'];} else {$id = $_GET['id'];}
$SQL = " SELECT * FROM music ";
$SQL = $SQL . " WHERE id = $id ";
$ret = mysql_db_query($db,$SQL,$cid);
$row = mysql_fetch_array($ret);
$artist = $row["artist"];
$title = $row["title"];
$id = $row["id"];
?>
<form name="form1" method="post" action="requestcd.php">
<INPUT TYPE="hidden" NAME="id" VALUE="<? echo("$id"); ?>">
<input name="name" type="text" id="name">
<input type="submit" name="Submit" value="Submit">
</form>
Thanks
Martin