How would you write a sql statement that allows you to insert data obtained from a form but will be entered in either one tabe or another depending on what is selected on the form? I know how to insert the data from a form to a specified table but I need to be able to use the form to select which table the data will be entered into. Here is a copy of my form...
print("<form action="<?=$PHP_SELF?>" enctype="multipart/form-data" method="post">
<fieldset>
<legend>Upload Your Motions and Orders Here</legend>
<table width="80%" border="0">
<tr>
<td class="label"> <label for="label">Select Your File:</label>
</p></td>
<td class="input"><input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="file" name="thefile" value="<? echo $thefile; ?>" accesskey="s" tabindex="10"></td>
</tr>
<tr>
<td class="label"><span class="input">
<label for="label">Type of File:</label>
</span></td>
<td class="input"><select name="field" id="field" value="<? echo $field; ?>" accesskey="t" tabindex="20">
<option value="Motions">Motions</option>
<option value="Orders">Orders</option>
</select> </td>
</tr>
<tr>
<td class="label"><label for="label">Name of File:</label> </td>
<td class="input"><label for="type"></label>
<input type="text" name="name" id="name" value="<? echo $name; ?>" accesskey="n" tabindex="30"></td>
</tr>
<tr>
<td class="label"><label for="label">Date Filed In Court:</label> </td>
<td class="input"><label for="date"></label>
<input type="text" name="date" id="date" value="<? echo $date; ?>" accesskey="f" tabindex="40"></td>
</tr>
<tr>
<td class="label"><span class="input">
<label for="label">Description:</label>
</span></td>
<td class="input"><textarea name="description" id="description" cols="30" rows="5" value="<? echo $description; ?>" accesskey="d" tabindex="50"></textarea></td>
</tr>
<tr>
<td class="label"> </td>
<td class="input"><input type="submit" name="submit" value="Upload This File" /></td>
</tr>
</table>
</fieldset>
</form>");`
<form action="<?=$PHP_SELF?>" enctype="multipart/form-data" method="post">
<fieldset>
<legend>Upload Your Motions and Orders Here</legend>
<table width="80%" border="0">
<tr>
<td class="label"> <label for="label">Select Your File:</label>
</p></td>
<td class="input"><input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="file" name="thefile" value="<? echo $thefile; ?>" accesskey="s" tabindex="10"></td>
</tr>
<tr>
<td class="label"><span class="input">
<label for="label">Type of File:</label>
</span></td>
<td class="input"><select name="field" id="field" value="<? echo $field; ?>" accesskey="t" tabindex="20">
<option value="Motions">Motions</option>
<option value="Orders">Orders</option>
</select> </td>
</tr>
<tr>
<td class="label"><label for="label">Name of File:</label> </td>
<td class="input"><label for="type"></label>
<input type="text" name="name" id="name" value="<? echo $name; ?>" accesskey="n" tabindex="30"></td>
</tr>
<tr>
<td class="label"><label for="label">Date Filed In Court:</label> </td>
<td class="input"><label for="date"></label>
<input type="text" name="date" id="date" value="<? echo $date; ?>" accesskey="f" tabindex="40"></td>
</tr>
<tr>
<td class="label"><span class="input">
<label for="label">Description:</label>
</span></td>
<td class="input"><textarea name="description" id="description" cols="30" rows="5" value="<? echo $description; ?>" accesskey="d" tabindex="50"></textarea></td>
</tr>
<tr>
<td class="label"> </td>
<td class="input"><input type="submit" name="submit" value="Upload This File" /></td>
</tr>
</table>
</fieldset>
</form>
The type of file selection field will be what determines the table the data will be inserted into.