My problem is when I add an image I have to use code eg (<img src="images/drums.gif">) into the form text box but I want to just be able to enter the name of the image instead of the code.
Code for form:
Code: Select all
<?php
@$db = new mysqli( 'localhost', 'root', "", 'k00127082');
if (mysqli_connect_errno()) {
echo 'error connecting to db';
exit;
}
$product_name=$_POST["product_name"];
$id=$_POST["id"];
$product_description=$_POST["product_description"];
$quantity_on_hand=$_POST["quantity_on_hand"];
$price=$_POST["price"];
$image=$_POST["image"];
$image_big=$_POST["image_big"];
$query = "INSERT INTO products ( product_name, id, product_description, quantity_on_hand, price, image, image_big )
VALUES('$product_name', '$id', '$product_description', '$quantity_on_hand', '$price', '$image', '$image_big' )";
$result = $db->query($query);
if($result)
echo $db->affected_rows . ' products inserted into database';
else
echo 'There was a problem inserting the information into the database';
$db->close();
?>