i have a form where the user sets the number of rows, but the first 3 elements are always what I need to insert into DB. I can't seem to get a loop that will insert the proper data into the proper fields:
i've been working with this:
$arr = array_values((${"HTTP_".$REQUEST_METHOD."_VARS"}));
$row = array( $arr[0], $arr[1], $arr[2]);
foreach($row as $key => $value )
{
$sql = "INSERT INTO recipe( ingredient, portion_type, portion_amt ) VALUES ( '$row[0]', '$row[1]', $row[2] )";
$result = mysql_query( $sql ) or die ( mysql_error() );
}
Any help is always appreciated,
Pete