I'm trying to create an RMA form. The idea is to have the ability to enter multiple rows with on one page. The problem I'm having is that if I have the form with more than one row it only submits the top row of data. I looked around and read that I should be using a foreach() and implode() function but I can't seem to get it to work.
This is my entire PHP code that currently WORKS with a single row. If someone could please help me get multiple rows in as well that'd be great. Also I don't have much experience with php/mysql so if you could please list an example instead of saying "use x,y,z functions" because that hasn't helped me so far.
All assisstance is greatly appreciated. Thanks
<html><head><title> TEST - RMA</title></head>
<body>
<h1>RMA Screen</h1>
<h2>Order Results</h2>
<?php
  $controller_serial = $_POST['controller'];
  $sample_holder_serial = $_POST['sampleholder'];
  $first_name = $_POST['firstname'];
  $last_name = $_POST['lastname'];
  $randomnumber = $_POST['RMAnum'];
  $link = mysql_connect('localhost', 'user', 'abcd'); 
  if (!$link) 
  {
    die('Could not connect: ' . mysql_error()); 
  }
  echo 'Connected successfully';
  mysql_select_db(rma);
  $randomnumber = mt_rand(1,100);
  while( $fetch = mysql_fetch_array( 
    mysql_query("SELECT `RMAnum` FROM `rma` 
                 WHERE `RMAnum` = $randomnumber") ) ) {
    $randomnumber = mt_rand(1,10);
  }
  mysql_query("INSERT INTO `rma` 
            (`controller_serial`, `sample_holder_serial`
            , `first_name`, `last_name`, `RMAnum`)
            VALUES('$controller_serial','$sample_holder_serial'
            , '$first_name', '$last_name', '$randomnumber')") 
    or die(mysql_error());
  mysql_close($link);
  echo 'Thanks for submitting the form.<br />';
  echo 'RMA NUMBER: ' . $randomnumber . '<br />';
  echo 'Controller Serial Number: ' . $controller_serial . '<br />';
  echo 'Sample Holder Serial Number: ' . $sample_holder_serial . '<br />';
  echo 'First Name: ' . $first_name . '<br />';
  echo 'Last Name: ' . $last_name . '<br />';
?>
</body></html>
 
     
     
     
     
     
     coding horror
coding horror 