I have an intranet site that tracks service requests.
I need an easy way to "close out" the tickets. Basically, each ticket will have at least one "item number", "quantity", and "cost".
The problem I am having is creating a form so that the users can enter as many items as they wish. they should be able to "add" as many items as necessary to the ticket. So, for instance if they have 6 items to add, they can do so.
I just don't know how to proceed. I was going to create the following form. As you can see, this would be rather cumbersome. I am sure that there is another way to do this and I need some advice. If I used this form, the PHP involved would be very reptitious and LONG with ALOT of if-else statements looking to see if an item is "included". The include checkbox is only to help the code not process items that are left blank. Is there a better way??
There is a ticket tabel that tracks the tickets, and I was going to make a table just to hold the items like this -
item_id
ticket_id (links this item row to the ticket in question)
sku_id
qty
cost
<form method = 'post' action = 'bill_out_form.php' name = 'bill_out'>
<table>
<tr>
<th>Include</th>
<th>SKU/GPD#</th>
<th>Qty</th>
<th>Cost</th>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_1' value = 'true' /></td>
<td><input type = 'text' name = 'sku_1' size = '15' /></td>
<td><input type = 'text' name = 'qty_1' size = '15' /></td>
<td><input type = 'text' name = 'cost_1' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_2' value = 'true' /></td>
<td><input type = 'text' name = 'sku_2' size = '15' /></td>
<td><input type = 'text' name = 'qty_2' size = '15' /></td>
<td><input type = 'text' name = 'cost_2' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_3' value = 'true' /></td>
<td><input type = 'text' name = 'sku_3' size = '15' /></td>
<td><input type = 'text' name = 'qty_3' size = '15' /></td>
<td><input type = 'text' name = 'cost_3' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_4' value = 'true' /></td>
<td><input type = 'text' name = 'sku_4' size = '15' /></td>
<td><input type = 'text' name = 'qty_4' size = '15' /></td>
<td><input type = 'text' name = 'cost_4' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_5' value = 'true' /></td>
<td><input type = 'text' name = 'sku_5' size = '15' /></td>
<td><input type = 'text' name = 'qty_5' size = '15' /></td>
<td><input type = 'text' name = 'cost_5' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_6' value = 'true' /></td>
<td><input type = 'text' name = 'sku_6' size = '15' /></td>
<td><input type = 'text' name = 'qty_6' size = '15' /></td>
<td><input type = 'text' name = 'cost_6' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_7' value = 'true' /></td>
<td><input type = 'text' name = 'sku_7' size = '15' /></td>
<td><input type = 'text' name = 'qty_7' size = '15' /></td>
<td><input type = 'text' name = 'cost_7' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_8' value = 'true' /></td>
<td><input type = 'text' name = 'sku_8' size = '15' /></td>
<td><input type = 'text' name = 'qty_8' size = '15' /></td>
<td><input type = 'text' name = 'cost_8' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_9' value = 'true' /></td>
<td><input type = 'text' name = 'sku_9' size = '15' /></td>
<td><input type = 'text' name = 'qty_9' size = '15' /></td>
<td><input type = 'text' name = 'cost_9' size = '15' /></td>
</tr>
<tr>
<td><input type = 'checkbox' name = 'include_10' value = 'true' /></td>
<td><input type = 'text' name = 'sku_10' size = '15' /></td>
<td><input type = 'text' name = 'qty_10' size = '15' /></td>
<td><input type = 'text' name = 'cost_10' size = '15' /></td>
</tr>
<tr>
<td colspan = '4'>
<input type = 'hidden' name = 'tid' value = '<?php echo $tid; ?>'>
<input type = 'hidden' name = 'tnum' value = '<?php echo $tnum; ?>'>
<input type = 'hidden' name = 'form_sub' value = 'true'>
<input type = 'submit' name = 'submit' value = 'CLOSE TICKET' />
</td>
</tr>
</table>
</form>