Name field must be filled out.
";
$num++;
}
if($_POST['category'] == "")
{
$error .= "The Category field must be filled out.
";
$num++;
}
if($_POST['short'] == "")
{
$error .= "The Short Description field must be filled out.
";
$num++;
}
if($_POST['full'] == "")
{
$error .= "The Full Description field must be filled out.
";
$num++;
}
if($_POST['image'] == "")
{
$error .= "The Image field must be filled out.
";
$num++;
}
if($_POST['price'] == "")
{
$error .= "The Price field must be filled out.
";
$num++;
}
if($num != 0)
{
echo "
$error
"; } if($num == 0) // If no errors { if($_POST['available'] == "available") // If the item is available { $available = 1; echo "checked"; } else { $available = 0; } $query = " INSERT INTO 'items' ( 'name' , 'category' , 'short' , 'full' , 'image' , 'price' , 'available' ) VALUES ( '".$_POST['name']."', '".$_POST['category']."', '".$_POST['short']."', '".$_POST['full']."', '".$_POST['image']."', '".$_POST['price']."', '".$available."' ) "; if(mysql_query($query)) { echo "The item has been added to the store."; } else { echo "There has been an error.
"; } } } else { ?>