Hello,
I am just trying to make a simple automated way of organizing some products in a database. Basically, I echoed all of the products and with each one I have a dropdown menu I can select a category. Then, I have all of these dropdowns in one form so I can submit all at one time.
To distinguish each dropdown, I have their names set as category.$productid so basically each dropdown is identified by the $productid.
Then, once the user submits this form, for each result in the database I find the $_POST[“category.$productid”]; . However, it cannot get these values. So, I tried using one variable in the $_POST but it still does not work. Is it not possible to place variables in $_POST? Here is the PHP for processing this-
$a = $_GET["a"];
if ($a == "go"){
$selectall = mysql_query("SELECT * FROM products ORDER BY productid DESC");
while ($row = mysql_fetch_array($selectall)){
$productid = $row["productid"];
$categorytxt = "category.";
$categoryid = $categorytxt.$productid;
$categoryvalue = $_POST["$categoryid"];
echo "CategoryID: $categoryid<br>Cat Value: ".$_POST["$categoryid"]."<br><br><br>";
}
}
This echos $categoryid but NOT $_POST[“categoryid”];
I have tried echoing $categoryvalue because it is the same as $_POST["$categoryid"]; but this did not work either.
Can someone please help?
Thanks