Salut j'ai un problème !!
Je m'explique. J'ai un menu déroulant qui affiche la liste de produit (a partir de la BDD).
Sous ce menu, une liste de champs inputs. J'aimerais que lorsque l'on sélectionne un produit 1 le prix s'affichera qui se trouve dans la BDD s'inscrivent automatiquement dans les "value" des inputs.
Tout ça, sans rechargement de la page.
mais malheureusement que le produit s'affiche et n'affiche pas le prix
j'ai une BDD test contient un tableau produit (id, prix )
voila mon code
Je vous remercie pour vos réponses.
<?php
$cn=mysql_connect("localhost","root","");
$se=mysql_select_db("test",$cn);
if ($cn){
echo "bien connecté";
}else{
echo "probléme";
}
?>
<!DOCTYPE HTML>
<html lang="fr">
<meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<title>SimplyShare</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css1/form.css" />
<link href="wForms/3.5/css/wforms-layout.css" rel="stylesheet" type="text/css" />
<link href="themes/get/25419.css" rel="stylesheet" type="text/css" />
<link href="wForms/3.5/css/wforms-jsonly.css" rel="alternate stylesheet" title="This stylesheet activated by javascript" type="text/css" />
<script type="text/javascript" src="wForms/3.5/js/wforms.js"></script>
<script type="text/javascript" src="wForms/3.5/js/wforms_custom_validation.js"></script>
<script type="text/javascript" src="js1/replace_variables.js"></script>
<script type="text/javascript">
if(wFORMS.behaviors.prefill) wFORMS.behaviors.prefill.skip = true;
</script>
<script type="text/javascript" src="wForms/3.5/js/localization-fr.js"></script>
</head>
<body class="default wFormWebPage">
<div id="tfaContent">
<div class="wFormContainer" style="width: default;" >
<div class=""><div class="wForm" id="tfa_6980290243314-WRPR" dir="ltr">
<div class="codesection" id="code-tfa_6980290243314">
<script>
function _calcAge(dob)
{
if(dob == 0)
{
return 0;
}
var _now = new Date();
var dob = new Date(dob);
return Math.floor( (_now-dob) / (1000*60*60*24*365.25) );
}
</script>
</div>
<h3 class="wFormTitle" id="tfa_6980290243314-T"><h3 id="tfa_6980290243314-T" class="wFormTitle">FORMULAIRE D'INSCRIPTION </h3></h3>
<div class="htmlSection" id="tfa_6980290243313">
<div class="htmlContent" id="tfa_6980290243313-HTML">
<div align="left"><b></b>
<br><br>
<b>Instructions : <br></b>
<ul>
<li>Pour toute question, n'hésitez pas à nous joindre au <b>(216) 71-230-195</b>.</li>
</ul>
</div></div></div>
<form method="post" action="F001.php" enctype="multipart/form-data">
<fieldset id="tfa_Address" class="section">
<legend id="tfa_Address-L"><b></b></legend>
<div id="tfa_6980290244516" class="section inline group">
<div id="tfa_6980290243487-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243487-L" for="tfa_6980290243487">
Produit :</label>
<div class="inputWrapper">
<div class="inputWrapper">
<select ><?php
$sql = "SELECT * FROM produit";
$q= mysql_query($sql) or die ("probléme d'affichage");
while ($r= mysql_fetch_assoc($q)){
echo "
<option value='".$r['id']."'>".$r['id']."</option>
";
}
?>
</select>
</div>
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label >
<?php
$sql1 = 'SELECT prix FROM produit where id = "'.$prix.'"';
$q= mysql_query($sql1) or die ("probléme d'affichage");
while ($r= mysql_fetch_assoc($q)){
echo "
$prix";
}
?>
Prix :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
Quantité :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
L'adresse e-mail :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
Mode Passe :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243487-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243487-L" for="tfa_6980290243487">
Veuillez choisir les options de paiement :</label>
<div class="inputWrapper">
<div class="inputWrapper">
<select name="Choisir" >
<option value="">Choisir</option>
<option value="FF01" class="">Paiement en especes ou par cheques</option>
<option value="FF02" class="">Paiement Banque</option>
<option value="FF03" class="">Paiement Electronique</option>
</select>
</div>
</div>
</div>
</div>
<div id="tfa_HomePhone" class="section inline group">
<label class="label preField" id="tfa_HomePhone-L">Numéros de téléphone</label><br><div id="tfa_6980290244518-D" class="oneField ">
<label class="label preField" id="tfa_6980290244518-L" for="tfa_6980290244518">Domicile</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244518" name="tfa_6980290244518" value="" placeholder="" class=""></div>
</div>
<div id="tfa_6980290244519-D" class="oneField ">
<label class="label preField" id="tfa_6980290244519-L" for="tfa_6980290244519">Cellulaire</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244519" name="tfa_6980290244519" value="" placeholder="" class=""></div>
</div>
<div id="tfa_6980290244520-D" class="oneField ">
<label class="label preField" id="tfa_6980290244520-L" for="tfa_6980290244520">Travail</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244520" name="tfa_6980290244520" value="" placeholder="" class=""></div>
</div>
</div>
<div id="tfa_6980290243410-D" class="oneField required ">
<label class="label preField" id="tfa_HomePhone-L">J'accepte les termes et les conditions de vente</label><br><div id="tfa_6980290244518-D" class="oneField ">
<div class="inputWrapper">
<span id="tfa_6980290243410" class="choices ">
<span class="oneChoice">
<input type="checkbox" value="tfa_6980290243411" class="" id="tfa_6980290243411" name="tfa_6980290243411">
<label class="label postField" id="tfa_6980290243411-L" for="tfa_6980290243411"> (voir) </label>
</div>
</fieldset>
<div class="actions">
<input type="submit" class="primaryAction" value="Envoyer">
</div>
<div style="clear:both"></div>
<input type="hidden" value="92-8257d183f247597534e8212274707ef0" name="tfa_dbCounters" id="tfa_dbCounters" autocomplete="off"><input type="hidden" value="281809" name="tfa_dbFormId" id="tfa_dbFormId"><input type="hidden" value="" name="tfa_dbResponseId" id="tfa_dbResponseId"><input type="hidden" value="e6fc70c6b58d418d8cae6525caa23fe4" name="tfa_dbControl" id="tfa_dbControl"><input type="hidden" value="1406795213" name="tfa_dbTimeStarted" id="tfa_dbTimeStarted" autocomplete="off"><input type="hidden" value="136" name="tfa_dbVersionId" id="tfa_dbVersionId"><div class="saveAndResume"><div class="oneField">
</div></div>
</form>
</div></div>
</div> </div>
<script src='js/iframe_resize_helper_internal.js'></script>
</body>
<!-- Mirrored from www.tfaforms.com/281809 by HTTrack Website Copier/3.x [XR&CO'2008], Thu, 31 Jul 2014 08:27:01 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
</html>
Je m'explique. J'ai un menu déroulant qui affiche la liste de produit (a partir de la BDD).
Sous ce menu, une liste de champs inputs. J'aimerais que lorsque l'on sélectionne un produit 1 le prix s'affichera qui se trouve dans la BDD s'inscrivent automatiquement dans les "value" des inputs.
Tout ça, sans rechargement de la page.
mais malheureusement que le produit s'affiche et n'affiche pas le prix
j'ai une BDD test contient un tableau produit (id, prix )
voila mon code
Je vous remercie pour vos réponses.
<?php
$cn=mysql_connect("localhost","root","");
$se=mysql_select_db("test",$cn);
if ($cn){
echo "bien connecté";
}else{
echo "probléme";
}
?>
<!DOCTYPE HTML>
<html lang="fr">
<meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<title>SimplyShare</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css1/form.css" />
<link href="wForms/3.5/css/wforms-layout.css" rel="stylesheet" type="text/css" />
<link href="themes/get/25419.css" rel="stylesheet" type="text/css" />
<link href="wForms/3.5/css/wforms-jsonly.css" rel="alternate stylesheet" title="This stylesheet activated by javascript" type="text/css" />
<script type="text/javascript" src="wForms/3.5/js/wforms.js"></script>
<script type="text/javascript" src="wForms/3.5/js/wforms_custom_validation.js"></script>
<script type="text/javascript" src="js1/replace_variables.js"></script>
<script type="text/javascript">
if(wFORMS.behaviors.prefill) wFORMS.behaviors.prefill.skip = true;
</script>
<script type="text/javascript" src="wForms/3.5/js/localization-fr.js"></script>
</head>
<body class="default wFormWebPage">
<div id="tfaContent">
<div class="wFormContainer" style="width: default;" >
<div class=""><div class="wForm" id="tfa_6980290243314-WRPR" dir="ltr">
<div class="codesection" id="code-tfa_6980290243314">
<script>
function _calcAge(dob)
{
if(dob == 0)
{
return 0;
}
var _now = new Date();
var dob = new Date(dob);
return Math.floor( (_now-dob) / (1000*60*60*24*365.25) );
}
</script>
</div>
<h3 class="wFormTitle" id="tfa_6980290243314-T"><h3 id="tfa_6980290243314-T" class="wFormTitle">FORMULAIRE D'INSCRIPTION </h3></h3>
<div class="htmlSection" id="tfa_6980290243313">
<div class="htmlContent" id="tfa_6980290243313-HTML">
<div align="left"><b></b>
<br><br>
<b>Instructions : <br></b>
<ul>
<li>Pour toute question, n'hésitez pas à nous joindre au <b>(216) 71-230-195</b>.</li>
</ul>
</div></div></div>
<form method="post" action="F001.php" enctype="multipart/form-data">
<fieldset id="tfa_Address" class="section">
<legend id="tfa_Address-L"><b></b></legend>
<div id="tfa_6980290244516" class="section inline group">
<div id="tfa_6980290243487-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243487-L" for="tfa_6980290243487">
Produit :</label>
<div class="inputWrapper">
<div class="inputWrapper">
<select ><?php
$sql = "SELECT * FROM produit";
$q= mysql_query($sql) or die ("probléme d'affichage");
while ($r= mysql_fetch_assoc($q)){
echo "
<option value='".$r['id']."'>".$r['id']."</option>
";
}
?>
</select>
</div>
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label >
<?php
$sql1 = 'SELECT prix FROM produit where id = "'.$prix.'"';
$q= mysql_query($sql1) or die ("probléme d'affichage");
while ($r= mysql_fetch_assoc($q)){
echo "
$prix";
}
?>
Prix :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
Quantité :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
L'adresse e-mail :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243481-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243481-L" for="tfa_6980290243481">
Mode Passe :</label>
<div class="inputWrapper">
<input type="text" id="tfa_6980290243481" name="tfa_6980290243481" value="" style="width: 200px" placeholder="" class="">
</div>
</div>
<br>
<div id="tfa_6980290243487-D" class="oneField required ">
<label class="label preField" id="tfa_6980290243487-L" for="tfa_6980290243487">
Veuillez choisir les options de paiement :</label>
<div class="inputWrapper">
<div class="inputWrapper">
<select name="Choisir" >
<option value="">Choisir</option>
<option value="FF01" class="">Paiement en especes ou par cheques</option>
<option value="FF02" class="">Paiement Banque</option>
<option value="FF03" class="">Paiement Electronique</option>
</select>
</div>
</div>
</div>
</div>
<div id="tfa_HomePhone" class="section inline group">
<label class="label preField" id="tfa_HomePhone-L">Numéros de téléphone</label><br><div id="tfa_6980290244518-D" class="oneField ">
<label class="label preField" id="tfa_6980290244518-L" for="tfa_6980290244518">Domicile</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244518" name="tfa_6980290244518" value="" placeholder="" class=""></div>
</div>
<div id="tfa_6980290244519-D" class="oneField ">
<label class="label preField" id="tfa_6980290244519-L" for="tfa_6980290244519">Cellulaire</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244519" name="tfa_6980290244519" value="" placeholder="" class=""></div>
</div>
<div id="tfa_6980290244520-D" class="oneField ">
<label class="label preField" id="tfa_6980290244520-L" for="tfa_6980290244520">Travail</label><br><div class="inputWrapper"><input type="text" id="tfa_6980290244520" name="tfa_6980290244520" value="" placeholder="" class=""></div>
</div>
</div>
<div id="tfa_6980290243410-D" class="oneField required ">
<label class="label preField" id="tfa_HomePhone-L">J'accepte les termes et les conditions de vente</label><br><div id="tfa_6980290244518-D" class="oneField ">
<div class="inputWrapper">
<span id="tfa_6980290243410" class="choices ">
<span class="oneChoice">
<input type="checkbox" value="tfa_6980290243411" class="" id="tfa_6980290243411" name="tfa_6980290243411">
<label class="label postField" id="tfa_6980290243411-L" for="tfa_6980290243411"> (voir) </label>
</div>
</fieldset>
<div class="actions">
<input type="submit" class="primaryAction" value="Envoyer">
</div>
<div style="clear:both"></div>
<input type="hidden" value="92-8257d183f247597534e8212274707ef0" name="tfa_dbCounters" id="tfa_dbCounters" autocomplete="off"><input type="hidden" value="281809" name="tfa_dbFormId" id="tfa_dbFormId"><input type="hidden" value="" name="tfa_dbResponseId" id="tfa_dbResponseId"><input type="hidden" value="e6fc70c6b58d418d8cae6525caa23fe4" name="tfa_dbControl" id="tfa_dbControl"><input type="hidden" value="1406795213" name="tfa_dbTimeStarted" id="tfa_dbTimeStarted" autocomplete="off"><input type="hidden" value="136" name="tfa_dbVersionId" id="tfa_dbVersionId"><div class="saveAndResume"><div class="oneField">
</div></div>
</form>
</div></div>
</div> </div>
<script src='js/iframe_resize_helper_internal.js'></script>
</body>
<!-- Mirrored from www.tfaforms.com/281809 by HTTrack Website Copier/3.x [XR&CO'2008], Thu, 31 Jul 2014 08:27:01 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
</html>