I have looked around but everything I have found doesn't work or apply to me.
This seems simple, but it hasn't been.
I have a list of values that I display from MYSQL with a delete box on the side. Some have a edit box too, but let's concentrate on delete.
?>
<center>
<table border="0" cellpadding="3">
<tr><td colspan=3>
<form action="admin_wishlist_index.php" method="POST">
<INPUT type="submit" name="add_entry_form" value="Add Entry">
<INPUT type="submit" name="edit_cat_form" value="Edit Categories">
<INPUT type="submit" name="edit_loc_form" value="Edit Locations">
</form>
</td></tr>
<tr><td>
</td></tr>
<?php
$sql = "select * from Description, Category,
location WHERE Description.cat_id = Category.cat_id &&
Description.loc_id = location.loc_id order by 'category'";
$result = mysql_query($sql) or die ("Invalid query");
$lastcat = "NULL";
print("</br>");
while ($row = mysql_fetch_array($result)) {
if ($row["category"] != $lastcat) {
print("<tr><td colspan=3></td></tr>");
print("<tr><td bgcolor=\"#e5e5e5\" colspan=3 rowspan=2><b>");
printf("<h3 align=\"center\">%s</h3></td>
<td bgcolor=\"#e5e5e5\" align=\"right\" rowspan=2>",
$row["category"]);
?>
<form action="admin_wishlist_index.php" method="POST">
<INPUT type="hidden" name="cat" value="<?=$cat?>">
<INPUT type="hidden" name="cat_id" value="<?=$cat_id?>">
<INPUT type="submit" name="edit_cat_form" value="Edit">
</form>
</td></tr>
<?php
}
print("<tr><td colspan=3></td></tr>");
print("<td><b>");
printf("%s</td><b>",
$row["entry"]);
if ($row["price_accur"] = 'Y'):
$acc = "$";
else:
$acc = "about $";
endif;
printf("<td align=right colspan=2 rowspan= 2> Price: %s%s</td>
<td rowspan=2 align=right>", $acc, $row["price"]);
?>
<?php
print("</td></tr>\n");
if ($row["desc"] != ''){
printf("<td> %s</td>\n",
$row["desc"]);
}
if ($row["loc_link"] == '') {
printf("<tr><td colspan=2> %s </td></tr>\n",
$row["location"]);
}
else {
printf("<tr><td colspan=2> <a href=\"%s\"
target=\"_blank\">%s</a> </td></tr>\n",
$row["loc_link"], $row["location"]);
}
$lastcat = $row["category"];
}
?>
</table>
</center>
[COLOR=limegreen] <form action="admin_wishlist_index.php" method="POST">
<INPUT type="hidden" name="desc" value='$desc'>
<INPUT type="hidden" name="desc_id" value='$desc_id'>
<INPUT type="submit" name="edit_entry_form" value="Edit"></br>
<INPUT type="submit" name="deleted" value="Delete">
</form> [/COLOR]
I can't seem to send a variable that is defined before the form to be sent along with the form.
(as in $desc_id) I have tried about a thousand different ways of making the variable hidden, but I can't get it to pass. When I try to pull up $_POST["desc_id"] it is blank.
I can't set,
$_POST["desc_id"] = $desc_id;
because it changes as the while loop progresses.
Does anyone know how to send a variable that is already defined before a form with a form. I would not want to use sessions or cookies if possible.
Thanks