I have php form submission code to enter data into phpmyadmin. While I try to executed my code, I see my data was inserted into my table. But when I reload my browser (I'm using chrome and mozilla, and I cleared coockies of both chrome and mozilla), I lost my data in my table.
My problem is what is causing my data lost in my table? is there any problem with my code or there is any problem in server?
note: I worked online, not on my local server (XAMPP)
and here is my code:
// Insert
if ($menu=='news' AND $submit=='input'){
$file_loc = $_FILES['upload']['tmp_name']
$file_type = $_FILES['upload']['type'];
$file_name = $_FILES['upload']['name'];
$rand = rand(1,99);
$unique_file = $rand.$file_name;
// If any image uploaded
if (!empty($file_loc)){
if ($file_type != "image/jpeg" AND $file_type != "image/pjpeg"){
echo "<script>alert('Upload failed. Be sure your image is JPEG
format.');window.history.go(-1);</script>";
} else {
mysql_query("INSERT INTO news (title, category_name, news_content, date, time, image) VALUES ('$_POST['title']', '$_POST['category_name']','$_POST['news_content']', '$date', '$time', '$_POST['tag']', '$unique_file')");
header('location:../../media.php?menu='.$menu);
}
}
}
Thanks for any advice and guidance