Reason (if not available) |
<select name="reason" id="reason">
<option value=""></option>
<option value="Out">Out of Stock</option>
<option value="Item Broken">Item Broken</option>
<option value="Manufacture Discontinued">Manufacture Discontinued</option>
<option value="Other">Other, Read Comments</option>
</select>
</td>
</tr>
<td>
</td>
</tr>
<tr class="comments">
<td class="comments" style="height: 53px">Comments</td>
<td class="comments" style="height: 53px">
<textarea name="comments" id="comments" style="height: 50px"></textarea>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
</td>
<div id="image" style="height: 190px"></div>
</tr>
<tr><td style="height: 174px">
<fieldset id="image" class="center" style="height: 165px"><legend>Part Image</legend>
<center style="height: 143px"><p>Select product image to upload<br><br><input type="file" name="image" id="image"></p></center></fieldset>
<fieldset id="image">
<legend id="infoLegend">Important Dates</legend>
<div id="InfoContent" style="height: 143px">
<table>
<tbody>
<tr class="warranty_date">
<td class="warranty_date" style="width: 115px">Warranty Date</td>
<td class="warranty_date" style="width: 116px">
<input type="text" name="warranty_date" id="warranty_date" style="width: 112px">
</td>
</tr>
<tr class="purchase_date">
<td class="purchase_date" style="height: 30px; width: 115px">Purchase Date</td>
<td class="purchase_date" style="height: 30px; width: 116px;">
<input type="text" name="purchase_date" id="purchase_date" style="width: 112px">
</td>
</tr>
<tr class="futureuse">
<td class="futureuse" style="width: 115px; height: 30px;">Future</td>
<td class="futureuse" style="height: 30px; width: 116px;">
<input type="text" name="futureuse" id="futureuse" style="width: 112px">
</td>
</tr>
<tr class="futureuse2">
<td class="futureuse2" style="height: 23px; width: 115px;">
Future</td>
|
<input type="text" name="futureuse2" value="" id="futureuse2" style="width: 112px">
</td>
</tr>
</tbody>
</table>
</div>
</fieldset></td></tr>
<!----------------- NEW FIELDSET OF FORM ------------------->
<tr id = "location">
<td id="location" style="height: 57px">
<legend id="infoLegend">Location</legend>
<div id="InfoContent">
<table>
<tbody>
<tr class="location">
<td class="auto-style3" style="height: 30px; width: 92px;">
Shelf Number</td>
<td>
<input type="text" name="location" value="" id="location">
</td>
</tr>
</tbody>
</table>
</div>
</fieldset></td></tr>
</table>
<!------------------------------ END OF THIS FIELDSET ----------------------------------->
<table id="submitform">
<tbody>
<tr><td><br></td></tr>
<tr>
<td colspan="2">
<input type="submit" value="Add New Item" id="form_submit">
<input type="reset" value="Reset Form" class="table_button">
</td>
</tr>
</tbody>
</table>
</form>
</div>
[/code]
And here is my add_new_item.php Code:
[php]
Untitled 2
<?php
$host=“localhost”;
$username=“root”;
$password=“xxxxx”;
$db_name=“portal”;
$tbl_name=“inventory”;
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);
// Get values from form
$part_description=$_POST[‘part_description’];
$part_number=$_POST[‘part_number’];
$model_number=$_POST[‘model_number’];
$serial_number=$_POST[‘serial_number’];
$item_color=$_POST[‘item_color’];
$manufacture=$_POST[‘manufacture’];
$quantity=$_POST[‘quantity’];
$cost=$_POST[‘cost’];
$condition=$_POST[‘condition’];
$availability=$_POST[‘availability’];
$reason=$_POST[‘reason’];
$comments=$_POST[‘comments’];
$warranty_date=$_POST[‘warranty_date’];
$purchase_date=$_POST[‘purchase_date’];
$location=$_POST[‘location’];
$image=$_POST[‘image’]; // <---- This is line 37 for my error!
// Insert data into mysql
$sql=“INSERT INTO $tbl_name(part_description, part_number, model_number, serial_number, item_color, manufacture, quantity, cost, condition, availability, reason, comments, warranty_date, purchase_date, location, image) VALUES(’$part_description’, ‘$part_number’, ‘$model_number’, ‘$serial_number’,’$item_color’,’$manufacture’,’$quantity’,’$cost’,’$condition’,’$availability’,’$reason’,’$comments’,’$warranty_date’,’$purchase_date’,’$location’, ‘$image’)”;
$result=mysql_query($sql);
// if successfully insert data into database, displays message “Successful”.
if($result){
echo “Successful”;
echo “ ”;
echo “Back to main page”;
}
else {
echo “ERROR”;
}
// close connection
mysql_close();
?>
[/php]
Just a note that the current code to submit the image and save the image path is NOT what I’m using to submit the form, I want to get passed this image error before I add that.
|