Jump to content

submmiting 2 input fields into a php array


steve m

Recommended Posts

Hi,

 

I'm trying to create a form that list row from a database and when I display the results it puts a checkbox and a text field for quantity.  I am able to create an array from the checkboxes submitted and then I can display or do what ever I need to with that array.  The problem that I'm having is that along with the checkboxes I need to submit the quantities along with it.

 

First part:

 

<td width='5%' style='margin-left: 4px; border-bottom: 1px solid #DBDBDB;' height='30'>
<input type='checkbox' name='row[]' value='$row[man_pn]'>
</td>
<td width='60%' style='margin-left: 4px; border-bottom: 1px solid #DBDBDB;' height='30'>
<p class='itemtitle'>
  $row[item_title]
</p>
</td>
<td width='15%' style='margin-left: 4px; border-bottom: 1px solid #DBDBDB;' height='30'>
<p class='itemtitle'>
  $row[r3_price]
</p>
</td>
<td width='20%' style='margin-left: 4px; border-bottom: 1px solid #DBDBDB;' height='30'>
<input type='text' value='1' name='qty' size='3'>
</td>

 

Second part:

 

foreach($_POST["row"] as $select_rows)
{
$item_query = mysql_query("SELECT * from equipment where man_pn = '$select_rows'") or die("error: " . mysql_error());

while($fetchrows = mysql_fetch_array($item_query))
{
    echo $fetchrows["item_title"] . " " . $fetchrows["r3_price"] . " " . $_POST["qty"] . "<br>";
}				
}

 

If you look at the first part I have the checkbox field that becomes the array when submitted.  Is there a way to add the QTY filed with the row[] array?

 

Thank you in advance

 

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.