Jump to content

Passing multiple table values


emmavt

Recommended Posts

I have a products table that I have created from a query, but I need to update the information based on quatity. What I am confused about is how to pass the multiple values to another page when they have the same variable names.

 

here is my table:

echo "<table width='100' border='1'><form>";
echo "<tr><th>Product ID</th><th>Name</th><th>Price</th><th>Quantity</th><th>Total Price</th></tr>";
$count=0;
while($row2=mysql_fetch_assoc($result2)){
//grabbing results from the query 
$id=$row2['id'];
$productid=$row2['productid'];
$name=$row2['name'];
$price=$row2['price'];
$quantity=$row2['quantity'];
$totalprice=$price * $quantity;

$count++;
echo "<tr><td>$productid</td>
<td>$name</td>
<td>$price</td>
<td>$quantity</td>
<td>$totalprice</td></tr>"

;
}
//end table for db results
echo "</form></table>";

 

Any help wouyld be greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/64554-passing-multiple-table-values/
Share on other sites

You can create sub arrays of $_POST and $_GET using the array brackets on the end of your variable names...

 

<input type="checkbox" name="checkboxes[]" value="value1">  Value1
<input type="checkbox" name="checkboxes[]" value="value2">  Value2
<input type="checkbox" name="checkboxes[]" value="value3">  Value3
<input type="checkbox" name="checkboxes[]" value="value4">  Value4

 

Which will result in $_POST['checkboxes'] being an array that has values equal to the checked boxes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.