I'm doing a blog, and when I edit that blog for example the title, the other variables are declared as undefinex
, what can be done in this case?
$body = $_POST['body-post'];
$title = $_POST['title-post'];
$img = $_POST['avatar-post'];
$idautor = $_POST['idautor'];
$catid = $_POST['categoria-post'];
if ($title == "" || $catid == "" || $body == "" || $idautor == "" || $img == "" ) {
echo "Campos vacios";
}else{
$query = "INSERT INTO tbl_post(cat, title, body, image, id_autor, tags)
VALUES ('$catid', '$title' ,'$body','$img','$idautor', '')";
$inserted_rows = mysql_query($query);
if ($inserted_rows) {
echo "Bien datos Insertados";
header("Location: ../../index.php");
}
}