1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
<?php
if ((isset($_GET['nom_img']))&&($_GET['nom_img']!=""))
{ echo $_GET['nom_img'];
$photo=$_GET['nom_img'];
} else {$photo = "";}
echo "test post <br>";
echo $_POST['go'];
if (isset($_POST['go']) && $_POST['go']=='Enregistrer')
{
mysql_pconnect("localhost","root","");
mysql_select_db("olorganisation");
//-------------envoi dans caracteristique les caracteristiques de la moto a vendre
mysql_query('INSERT INTO caracteristiques VALUES ("","'.addslashes($_POST['cc']).'","'.addslashes($_POST['model']).'","'.addslashes($_POST['annee']).'","'.addslashes($_POST['cheveau']).'","'.addslashes($_POST['prix']).'","'.addslashes($_POST['commentaires']).'","'.addslashes($_POST['mecircu']).'","'.addslashes($_POST['km']).'","'.addslashes($_POST['cat']).'","'.date("Y-m-d H:i:s").'","'.addslashes($_POST['neufoccas']).'" )') or die (mysql.error().' : '.mysql.errno());
//-----------trouver idvehicule
$query_vehicule=mysql_query("SELECT idvehicule FROM type_vehicule WHERE lib_tv='Moto'") or die ("requète non executé idvehiculev");
$idvehiculev=mysql_result($query_vehicule,0);
//-----------trouver idmarques
$query_marque=mysql_query("SELECT idmarques FROM marques WHERE lib_m='Honda'") or die ("requète non executé idmarquesV");
$idmarquesv=mysql_result($query_marque,0);
//-----------trouver idcaracteristiques
$query_carac=mysql_query("SELECT idcaracteristiques FROM caracteristiques WHERE cc='$cc'") or die ("requète non executé idcarcteristiquesv");
$icaracteristiquesv=mysql_result($query_carac,0);
//--------------envoi dans louer vendre
mysql_query( 'INSERT INTO louervendre VALUES ("'.$idvehiculev.'","'.$idmarquesv.'","'.$icaracteristiquesv.'","","","non","'.addslashes($_POST['tof']).'")')or die ("pb");
mysql_close();
}else{echo"Variable non déclarer !!";}
?>
<html>
<head><title>Administration du site</title></head>
<body BACKGROUND="./images/bg_bleu.gif" BGPROPERTIES="fixed" BGCOLOR="Red">
<form action="" method="post">
<table>
<tr><td>
<span class="gras">cc :</span>
</td><td>
<input type="text" name="cc" maxlength="30" size="50" value="<?php if (isset($_POST['cc'])) echo stripslashes(htmlentities(trim($_POST['cc']))); ?>">
</td></tr><tr><td>
<span class="gras">Model :</span>
</td><td>
<input type="text" name="model" maxlength="50" size="50" value="<?php if (isset($_POST['model'])) echo stripslashes(htmlentities(trim($_POST['model']))); ?>">
</td></tr><tr><td>
<span class="gras">Année :</span>
</td><td>
<input type="text" name="annee" maxlength="50" size="50" value="<?php if (isset($_POST['annee'])) echo stripslashes(htmlentities(trim($_POST['annee']))); ?>">
</td></tr><tr><td>
<span class="gras">Cheveaux :</span>
</td><td>
<input type="text" name="cheveau" maxlength="50" size="50" value="<?php if (isset($_POST['cheveau'])) echo stripslashes(htmlentities(trim($_POST['cheveau']))); ?>">
</td></tr><tr><td>
<span class="gras">Prix :</span>
</td><td>
<input type="text" name="prix" maxlength="50" size="50" value="<?php if (isset($_POST['prix'])) echo stripslashes(htmlentities(trim($_POST['prix']))); ?>">
</td></tr><tr><td>
<span class="gras">Mise en circulation :</span>
</td><td>
<input type="text" name="mecircu" maxlength="50" size="50" value="<?php if (isset($_POST['mecircu'])) echo stripslashes(htmlentities(trim($_POST['mecircu']))); ?>">
</td></tr><tr><td>
<span class="gras">Km :</span>
</td><td>
<input type="text" name="km" maxlength="50" size="50" value="<?php if (isset($_POST['km'])) echo stripslashes(htmlentities(trim($_POST['km']))); ?>">
</td></tr><tr><td>
<span class="gras">Neuf/Occas :</span>
</td><td>
<input type="text" name="neufoccas" maxlength="50" size="50" value="<?php if (isset($_POST['neufoccas'])) echo stripslashes(htmlentities(trim($_POST['neufoccas']))); ?>">
</td></tr><tr><td>
<span class="gras">Catégorie :</span>
</td><td>
<input type="text" name="cat" maxlength="50" size="50" value="<?php if (isset($_POST['cat'])) echo stripslashes(htmlentities(trim($_POST['cat']))); ?>">
</td></tr><tr><td>
<span class="gras">Options,<br>Accessoires,<br>Precisions,<br>Commentaires :<br></span>
</td><td>
<textarea name="commentaires" cols="50" rows="10"><?php if (isset($_POST['commentaires'])) echo stripslashes(htmlentities(trim($_POST['commentaires']))); ?></textarea>
</td></tr><tr><td><td align="right">
<input type="hidden" name="tof" value="<?php echo $photo; ?>">
<input type="submit" name="go" value="Enregistrer">
</td></tr></table>
</form>
</body>
</html> |