recuparation de donnée par post
Posté : 19 oct. 2006, 14:32
bonjour ;
dans le formulaire qui suit, le bouton submit réactualise le formulaire et effectue ou non le code php. je tent de récupérer le contenu des deux champs du formulaire mais sans succes :
vous avez peut etre une idée !
merci
dans le formulaire qui suit, le bouton submit réactualise le formulaire et effectue ou non le code php. je tent de récupérer le contenu des deux champs du formulaire mais sans succes :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>.:Artcom Production:.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<?
//connexion à la base
include("../modules/inc_connec.php");
//inclusion des modules nécessaires
include("../modules/inc_creer_th.php");
include("../modules/inc_upload.php");
include("../modules/inc_nettoie_fic.php");
include("../modules/inc_textToHtml.php");
if($ajout==1){
//upload de l'image
if($fic_name!=""){
//upload de l'image et création des thumbs
$dest="images/perso/img_mot1.jpg";
if(upload($fic,"../".$dest,$fic_size,200)){
creer_th("../".$dest,440,"_".nettoie_fic($nom));
creer_th("../".$dest,80,"_".nettoie_fic($nom)."_th");
unlink("../".$dest);
$dest="images/perso/".$ref."_".nettoie_fic($nom).".jpg";
$result='RESULTAT : Modification de l\'image effectué.';
}
}
}
//insertion dans la base
$req="INSERT INTO mot VALUES (".$_POST[ref].",".$_POST[ref].")";
if(mysql_query($req)){
$result=("L\'insertion du produit a été effectuée avec succès.");
}
?>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form action="accueil_mot.php?ajout=1" method="post" enctype="multipart/form-data" name="form1">
<table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tr>
<td width="1" height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
<td height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
<td width="1" height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
</tr>
<tr>
<td width="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
<td><table width="100%" border="0" cellspacing="0." cellpadding="0">
<tr>
<td height="30" align="center" class="accueil_lien"> </td>
<td height="30" align="center" class="accueil_lien"><div align="justify">
<?
echo $result;
?>
</div></td>
</tr>
<tr>
<td height="30" align="center" class="adminTitre style1"> </td>
<td height="30" align="center" class="adminTitre style1">Modifier le mot d'accueil </td>
</tr>
<tr>
<td width="129" class="fiche_autre_ref">Titre</td>
<td width="369"><input name="ref" type="text" class="adminTxt" id="ref" value="<?
$sql = 'SELECT titre FROM mot';
$req = mysql_query($sql) or die("Impossible de se connecter : " . mysql_error());
while ($res= mysql_fetch_array($req)) {
echo $res['titre'];
}
?>" size="62"></td>
</tr>
<tr>
<td width="129" valign="top" class="fiche_autre_ref">Contenu</td>
<td><textarea name="contenu" cols="60" rows="8" class="adminTxt" id="contenu"><?
$sql = 'SELECT contenu FROM mot';
$req = mysql_query($sql) or die("Impossible de se connecter : " . mysql_error());
while ($res= mysql_fetch_array($req)) {
echo $res['contenu'];
}
?>
</textarea></td>
</tr>
<tr>
<td width="129" class="fiche_autre_ref">Photo (200Ko max) </td>
<td><input name="fic" type="file" accept="image/jpeg" class="adminTxt" id="fic" size="50"></td>
</tr>
<tr>
<td height="30" align="center"><div align="center"><br>
</div></td>
<td height="30" align="center"><div align="left">
<input type="submit" name="Submit2" value="Modifer le mot d'accueil">
</div></td>
</tr>
</table></td>
<td width="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
</tr>
<tr>
<td width="1" height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
<td height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
<td width="1" height="1" background="../images/confirmation_fond_clair.jpg"><img src="../images/confirmation_fond_clair.jpg" width="1" height="1"></td>
</tr>
</table>
</form></td>
</tr>
</table>
<?
mysql_close();
?>
</body>
</html>
mon soucis se situe au niveau de :donc comme vous le voyez , j'essaye par $_post mais non.//insertion dans la base
$req="INSERT INTO mot VALUES (".$_POST[ref].",".$_POST[ref].")";
vous avez peut etre une idée !
merci