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
|
//MON FORMULAIRE DE SAISIE
// JE SUIS CONTRAINT DE FAIRE QU'UN SEUL ET UNIQUE FORMULAIRE POUR GERER LES ENTREES
<form enctype="multipart/form-data" action="modif_bain_balneo2.php" method="post">
<table border="1">
<tr>
<td>Veuillez saisir sa reference</td>
<td><input name="ajout_reference" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir ses dimensions</td>
<td colspan="2"><input name="ajout_dimension" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir ses son prix</td>
<td><input name="ajout_prix" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir une caracteristique complementaire </td>
<td><input name="ajout_carac1" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir une caracteristique complementaire </td>
<td><input name="ajout_carac2" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir une caracteristique complementaire </td>
<td><input name="ajout_carac3" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir une caracteristique complementaire </td>
<td><input name="ajout_carac4" type="text"></input></td>
</tr>
<tr>
<td>Veuillez saisir une caracteristique complementaire </td>
<td><input name="ajout_carac5" type="text"></input></td>
</tr>
<tr>
<td>Veuillez uploader une image d'illustration</td>
<input type="hidden" name="MAX_FILE_SIZE" value="250000"></input>
<td><input type="file" name="fic"></input></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Envoyer"></input></td>
</tr>
</table>
</form>
//MON SCRIPT DE RECUPERATION ET D'INSERTION EN BASE
<?php
mysql_connect("localhost", "root", "") or die ("impossible de se connecter à MySQL");
mysql_select_db("propiscine") or die ("impossible de se connecter à la base de données");
// Récupération des variables
//echo file_get_contents ($_FILES['fic']['tmp_name']);
$reference = $_POST['ajout_reference'];
$dimension = $_POST['ajout_dimension'];
$prix = $_POST['ajout_prix'];
$image = file_get_contents ($_FILES['fic']['tmp_name']);
$carac1 = $_POST['ajout_carac1'];
$carac2 = $_POST['ajout_carac2'];
$carac3 = $_POST['ajout_carac3'];
$carac4 = $_POST['ajout_carac4'];
$carac5 = $_POST['ajout_carac5'];
// Insertion en base de données
$requete = mysql_query("insert into baignoires_balneo (id, nom, dimension, prix, photo, autre1, autre2, autre3, autre4, autre5) values ('','$reference','$dimension','$prix',addslashes ($image),'$carac1','$carac2','$carac3','$carac4','$carac5')") or die ("requête d'ajout de produit baignoire balneo incorrecte");
//MON SCRIPT D'AFFICHAGE
<?php
$requete = mysql_query("select * from baignoires_balneo order by id") or die ("requête d'affichage des produits bain-balneo incorrecte");
while ($donnees=mysql_fetch_array($requete))
{
?>
<p class="affichage_table">
<table border="1">
<tr>
<td colspan="4"><?php echo $donnees['photo']; ?>"></td>
</tr>
</table>
<?
}
?> |
Partager