user2411816 user2411816 - 2 years ago 91
SQL Question

undefined index logical error in php

this is my html code....

<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Add New Templete</title>
<link rel="stylesheet" href="style.css">
<?php include 'side.php'; ?>
<div class="main">
<h2>Add New Templete</h2>
<form method="post" action="add.php" enctype="multipart/form-data">
<table border="1px solid">
<td>Templete Name:</td><td><input type="text" name="temp_name"></td></tr>
<td>Templete Category</td><td><input type="text" name="category"></td></tr>
<td>Templete Image</td><td><input type="file" name="image"></td></tr>
<td>Templete Discription</td><td><input type="text" name="decp"></td></tr>
<td>Templete Quantity</td><td><input type="text" name="qty"></td></tr>
<td>Templete Price</td><td><input type="text" name="price"></td></tr>
<input type="submit" value="ADD">


and this is my php code

include 'connection.php';
$qry="INSERT INTO templetes(templete_name,category,image,description,quantity,price)VALUES('$name','$cat','$image','$desc','$qty','$price')";

echo "record inserted";

Every thing are fine the data will be stored in database but the image are not stored in database, it says "undefined index image on ....... line ...." means it will show the undefined index error. all the data will stored except the image?

Answer Source

Try this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download