PHP Code:
$date= date("ymdhis" );
$promotion = (!empty($_POST['promotion'])) ? addslashes($_POST['promotion']) : '';
$ordrepromo = (!empty($_POST['ordrepromo'])) ? addslashes($_POST['ordrepromo']) : '';
$news= (!empty($_POST['news'])) ? addslashes($_POST['news']) : '';
$ordrenew = (!empty($_POST['ordrenew'])) ? addslashes($_POST['ordrenew']) : '';
$category = (!empty($_POST['category'])) ? addslashes($_POST['category']) : '';
$subTopics = (!empty($_POST['subTopics'])) ? addslashes($_POST['subTopics']) : '';
$mark = (!empty($_POST['mark'])) ? addslashes($_POST['mark']) : '';
$namecuisine = (!empty($_POST['namecuisine'])) ? addslashes($_POST['namecuisine']) : '';
$built = (!empty($_POST['built'])) ? addslashes($_POST['built']) : '';
$posable = (!empty($_POST['posable'])) ? addslashes($_POST['posable']) : '';
$name = (!empty($_POST['name'])) ? addslashes($_POST['name']) : '';
$reference = (!empty($_POST['reference'])) ? addslashes($_POST['reference']) : '';
$description = (!empty($_POST['description'])) ? addslashes($_POST['description']) : '';
$note = (!empty($_POST['note'])) ? addslashes($_POST['note']) : '';
$view = (!empty($_POST['view'])) ? addslashes($_POST['view']) : '';
$guarantee = (!empty($_POST['guarantee'])) ? addslashes($_POST['guarantee']) : '';
$label = (!empty($_POST['label'])) ? addslashes($_POST['label']) : '';
$consumption = (!empty($_POST['consumption'])) ? addslashes($_POST['consumption']) : '';
$dimension = (!empty($_POST['dimension'])) ? addslashes($_POST['dimension']) : '';
$color = (!empty($_POST['color'])) ? addslashes($_POST['color']) : '';
$price = (!empty($_POST['price'])) ? addslashes($_POST['price']) : '';
$promo = (!empty($_POST['promo'])) ? addslashes($_POST['promo']) : '';
$aFile = (!empty($_POST['aFile'])) ? addslashes($_POST['aFile']) : '';
//
if (is_uploaded_file($_FILES['aFile']['tmp_name'])){
echo "<b>Name of the file on the server :<b> " . $_FILES['aFile']['tmp_name'] . "<br>";
echo "<b>Filesize :<b>" . $_FILES['aFile']['size'] . "<br>";
echo "<b>Type of file :<b>" . $_FILES['aFile']['type'] . "<br>";
copy($_FILES['aFile']['tmp_name'],"./upload/${date}-immo.jpg" );
$query = "INSERT INTO products (date,promotion, ordrepromo, news, ordrenews, category, subTopics, mark, namecuisine, built, posable, name, reference, description, note, view, guarantee, label, consumption, dimension, color, price, promo, aFile) VALUES(NOW(),'$promotion','$ordrepromo','$news','$ordrenew','$category','$subTopics','$marque','$namecuisine','$built','$posable','$name','$reference','$description','$note','$view','$guarantee','$label','$consumption','$dimension','$color','$price','$promo', '${date}-immo.jpg' )";
}
else{
$query = "INSERT INTO produits (date,promotion, ordrepromo, news, ordrenew, category, subTopics, mark, namecuisine, built, posable, name, reference, description, note, opinion, guarantee, label, consumption, dimension, color, price, promo, aFile)
VALUES(NOW(),'$promotion','$ordrepromo','$news','$ordrenew','$category','$subTopics','$marque','$namecuisine','$built','$posable','$name','$reference','$description','$note','$view','$guarantee','$label','$consumption','$dimension','$color','$price','$promo', '' )";
echo "No file uploaded !?";
}
$res = mysql_query($query) or die(mysql_error());
echo 'Your data is saved.';
mysql_close();
?>
Bookmarks