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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.