add.php
<?php include 'recipe2db.php' ?>
<div align="left"><img src="Cookie Banner edited.jpg" width="1100" height="200" />
<form name="form7" method="post" action="add_process.php">
</p>
<p> </p>
<table align="center" border="3" cellpadding="2" cellspacing="2">
<tr>
<td>catagory :</td>
<td>
<?php
include 'recipe2db.php';
$query="SELECT id_category, category_name FROM category";
$result = mysql_query ($query);
echo "<select name=category value=''></option>";
// printing the list box select command
while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id_category]>$nt[category_name]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>
</td>
</tr>
<td>recipe name :</td>
<td><input name="name" type="text" maxlength="100"></td>
<tr>
<td>ingredient :</td>
<td><textarea name="ingredient" cols="100" rows="20"></textarea></td>
</tr>
<tr>
<td>cooking instruction :</td>
<td><textarea name="cooking_ins" cols="100" rows="20"></textarea></td>
</table>
<td align="center"><p>
</p>
<p>
<input type="submit" name="btnadd" value="ADD" >
<input type="submit" name="cancel" value="cancel" >
</p></td>
</form>
add_process.php
<html>
<body>
<?php include 'recipe2db.php' ?>
<?php
$category=$_POST['id_category'];
$name=$_POST['name'];
$ingredient=$_POST['ingredient'];
$cooking_ins=$_POST['cooking_ins'];
$sql="INSERT INTO recipe(name, ingredient, cooking_ins,id_category)VALUES('$name', '$ingredient', '$cooking_ins','$category')";
$result=mysql_query($sql);
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='home.php'>HOME/a>";
}
else {
echo "ERROR";
}
mysql_close();
?>
</body>
</html>
i use this interface to insert the data, but it cannot save in the database.
can somebody help me.