[eluser]firstimer04[/eluser]
A Database Error Occurred
Error Number:
ERROR: invalid input syntax for integer: "" LINE 1: ...item(request_no,item_no,qty_requested) values ('45','10','') ^
insert into requested_item(request_no,item_no,qty_requested) values ('45','10','')
My question is how to handle this error if the user miss to fill the input fields of qty_requested? here's my code:
Code:
<h3>Request New Items</h3>
<table height="87" border="">
<tr>
<td height="25">Item Name</td>
<td>Description</td>
<td>Qty. On Hand</td>
<td>Qty. Ordered</td>
<td>Pending Request</td>
<td>Request Qty</td>
</tr>
<?php echo form_open('staff/do_request'); ?>
<?php if($items->num_rows() > 0) { foreach($items->result() as $row) { ?>
<tr>
<td height="28"><input type="checkbox" name="item_no[]" value="<?php echo $row->item_no; ?>"><?php echo $row->item_name; ?></td>
<td><?php echo $row->description; ?></td>
<td align="center"><?php echo $row->qty_onhand; ?></td>
<td align="center"><?php echo $row->qty_onorder; ?></td>
<td align="center"><?php echo $row->qty_requested; ?></td>
<td><input size="10" type="text" id="<?php echo $row->item_no; ?>" name="<?php echo $row->item_no; ?>" value="" /></td>
</tr>
<?php }} ?>
<tr>
<td height="30"><input type="submit" value="Submit Request" /></td>
</tr>
</table>