Save multiple records?

Hopefully somebody can help me with this.
I’m a beginner PHPer and do the most with trial and error / copy and paste.
I have now the following problem (see code):
I have a list from a database which I want to edit.
So if I mark a check-box and change some of the data it should be saved as a new record (to have also the history).

I have the code below, it works when I have only 1 record in the DB.

Thanks in advance,

// Create table
echo “”;
echo “

echo "


// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "

"; } echo "
  Product Description Quantity Price
<input name=‘checkbox[]’ type=‘checkbox’ session_id=‘checkbox[]’ value=’ “.$row[‘product_number’].” ‘> <input type=‘text’ value=’ “.$row[‘product’].” ’ maxlength=‘20’ size=‘20’ name=‘product[]’ /> <input type=‘text’ value=’ “.$row[‘description’].” ’ maxlength=‘30’ size=‘30’ name=‘description[]’ /> <input type=‘text’ value=’ “.$row[‘quantity’].” ’ maxlength=‘10’ size=‘10’ name=‘quantity[]’ /> <input type=‘text’ value=’ “.$row[‘price’].” ’ maxlength=‘10’ size=‘10’ name=‘price[]’ />


// Check if checkbox active, start this
if (isset($_POST[‘submit’])) {
$proceed = false; // Check if there has been done something
foreach ($_POST[‘nummer’] as $nummer) { // Check every checkbox and save his value
$sql = "INSERT INTO $tbl_name
(product, description, quantity, price)
VALUES (’$product’, ‘$description’, ‘$quantity’, ‘price’)
if (@mysql_query($sql)) {
$proceed = true; // Go to refresh
if ($proceed) {
echo “”;
echo “”;

Where is $_POST[‘nummer’] coming from?

Sponsor our Newsletter | Privacy Policy | Terms of Service