Ok this is starting to get frustrating 🙂 Thanks alot for your time and help though i really appreaciate it. Ok well I goto edit the record and made some changes to it and click submit and it doesn't update that record but it makes a new blank record grr. So i mean at least its doing something but its obvously not reading that infio and im sure its because something wrong with the way those variables are beeing fed in. Heres what that thing looks like now.
if ($_POST['submit']) {
// here if no ID then adding else we're editing
if ($id) {
$sql = "UPDATE enoch SET product='$product',product_id='$product_id',features='$features',specs='$specs',cat='$cat' WHERE id=$id";
} else {
$sql = "INSERT INTO enoch (product,product_id,features,specs,cat) VALUES ('$product','$product_id','$features','$specs','$cat')";
}
// run SQL against the DB
$result = mysql_query($sql);
echo "Record updated/edited!<p>";
} elseif ($delete) {
// delete a record
$sql = "DELETE FROM enoch WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Record deleted!<p>";
} else {
// this part happens if we don't press submit
if (!$id) {
// print the list if there is not editing
$result = mysql_query("SELECT * FROM enoch",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a> \n", $PHP_SELF, $myrow["id"], $myrow["id"], $myrow["product"], $myrow["product_id"]);
printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $_SERVER['PHP_SELF']?>">ADD A RECORD</a>
<P>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<?php
if ($id) {
// editing so select a record
$sql = "SELECT * FROM enoch WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$product = $myrow["product"];
$product_id = $myrow["product_id"];
$features = $myrow["features"];
$specs = $myrow["specs"];
$cat = $myrow["cat"];
// print the id for editing
?>
<?php
}
?>
<input type=hidden name="id" value="<?php echo $id ?>">
Product name:<input type="Text" name="product" value="<?php echo $product ?>"><br>
Product_id name:<input type="Text" name="product_id" value="<?php echo $product_id ?>"><br>
Features <textarea cols="50" rows="5" name="features" id="features"><?php echo $features ?></textarea><p>
Specifications <textarea cols="50" rows="5" name="specs" id="features"><?php echo $specs ?></textarea><br>
Category:<input type="Text" name="cat" value="<?php echo $cat ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
?>