0

First page adds a new job number, then the order page loaded with the job number id as a get id. Basically there is a while loop in the order page which shows products/services client can order and he chooses what he requires 'one or eight services' (8 in total) and some other variables like date of order and client name etc. Here is the order item code

The first sql statement executes fine, but in the second sql query nothing happens

$sql="insert into job_order(order_num,order_date,order_customer_id,
	order_remarks)
	values(".$_GET['id'].",NOW(),".$_POST['companyBox'].",'".$_POST['remarkBox']."');";
	$res=mysql_query($sql);
	
	$id=mysql_insert_id();
		
	
	foreach($_POST as $key => $value) {

	
        if(!empty($value)) { 
 
         $key.' => '.trim(strip_tags($value));  
     
         $order="INSERT INTO orderprod (order_num,prod_id,order_amount,teeth_amount) VALUES
	('$_GET[id]','$value','$value','$value');";
	$orderres=mysql_query($order) or die(mysql_error());
	}
	}
?>

=============

This is the formI have removed parts which are irrelevant. Please note that dateBox and companyBox are not required to be looping as they are only for first table,

echo "<form action=".$config_basedir."./vieworder.php?id=".$_GET['id']."  name=form1 method=post>";
?>
<table>
<tr>
<td><h4>JOB ORDER</H4></TD><TD></TD>
</TR>
<TR>
<TD>ORDER NUMBER</TD><TD><?PHP ECHO $_GET['id'] ?></td>
</tr>
<tr>
<td>ORDER DATE</td><td><input type=text name=dateBox></td>
</tr>

<tr>
<td>COMPANY NAME</td><td>
<?PHP
$sql="select * from customers";
$res=mysql_query($sql);
echo "<select name=companyBox><option value=''>Please select</option>";
WHILE($fetch=mysql_fetch_assoc($res)){
	
echo "<option value='".$fetch['id']."'>".$fetch['cust_name']."</option>";}
	echo "</select>";
	echo "</td></tr>";
	?>
	


</table>

<table>
<tr>
<th>ITEM</th><th>QUANTITY</th><th>N0. of Teeths</th>
</tr>
<tr>
<?PHP
$sql="select * from products";
$res=mysql_query($sql);

WHILE($fetch=mysql_fetch_assoc($res)){
	
echo "<td><input type=text name=desBox value='".$fetch['prod_id']."'>".$fetch['prod_name']."</td>
<td><input type=text name=quantBox></td>
<td><input type=text name=teethBox></td>";
echo "</tr>";}
echo "</table>";
?>

HERE IS THE IMAGE showing the populated services.
http://dubads.com/images/order.jpg

Edited by diginamics: n/a

2
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by diginamics
0

On line 17, shouldn't "$_GET[id]" be "$_GET" ?

either way it is working fine. As I said one entry is inserted into the table. I need to insert an array of while loop

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.