bonjour à tous et à toutes,
Je voudrais savoir comment remplir tous les champs d'un formulaire ,à l'identique d'autre champs, par le biais d'une checkbox,
voici le code javascript:
$insertSQL3 = sprintf("Select id_numero,Nom,prenom,nickname,mail,date_anniversaire,nationalite,lieu_residence,langue,sexe,situation,address,city,postal_code,telephone,yup_number from customer where yup_number ='".$_SESSION["aaaa"]." ';");
$Result3 = mysql_query($insertSQL3,$connex2) or die(mysql_error());
$col2=mysql_fetch_row($Result3);
?>
function verifie2(){
if(document.form2.termsofuse2.checked==true)
{
document.getElementById('address2')=<?php echo $col2[11]; ?>
document.getElementById('city2')=<?php echo $col2[12] ; ?>
document.getElementById('poxbox2')=<?php echo $col2[13] ?>;
document.getElementById('numtel2')= <?php echo $col2[14];?>
document.getElementById('email2')=<?php echo $col2[4]; ?>
document.getElementById('lieuresid2')=<?php echo $col2[7]; ?>
}
}
voici le checkbox:
<table align=center><tr> <td class=propTD>* Click here if it is the same address</td>
<td><input name="termsofuse2" type="checkbox" id="checke2" onClick="verifie2();"/></td></tr></table>
voici le formulaire déja rémpli:
<form action="test.php"name="form2" methode="post>"
<table>
<tr >
<td class="propTD" >* ADDRESS:</td>
<td > <textarea rows=3name=address id=adress readonly>golf-sud nord</textarea> </td>
</tr>
<tr >
<td class="propTD" >* CITY:</td>
<td > <input type=text name=city id=city value="dakar" readonly/> </td>
</tr>
<tr >
<td class="propTD" >* PO BOX:</td>
<td > <input type=text name=pox_box id=poxbox value="99000" readonly/> </td>
</tr>
<tr >
<td class="propTD" >PHONE NUMBER:</td>
<td > <input type=text name=num_tel id=numtel size=32 value="00221775019181" readonly/> </td>
</tr>
<tr>
<td class="propTD">* COUNTRY OF RESIDENCE:</td>
<td><select name="lieu_residence" id="lieuresid" readonly="true">
<option value="Afghanistan" >Afghanistan</option>
</tr>
</table>
voici les champs a remplir en cliquant sur le checkbox:
<table>
<tr >
<td class="propTD" >* ADDRESS:</td>
<td > <textarea rows=3name=address2 id=adress2 ></textarea> </td>
</tr>
<tr >
<td class="propTD" >* CITY:</td>
<td > <input type=text name=city2 id=city2 /> </td>
</tr>
<tr >
<td class="propTD" >* PO BOX:</td>
<td > <input type=text name=pox_box2 id=poxbox2 /> </td>
</tr>
<tr >
<td class="propTD" >PHONE NUMBER:</td>
<td > <input type=text name=num_tel2 id=numtel2 size=32/> </td>
</tr>
<tr>
<td class="propTD">* COUNTRY OF RESIDENCE:</td>
<td><select name="lieu_residence2" id="lieuresid2" >
<option>Select Country of Residence:</option>
<option>Afghanistan</option>
</select>
</td>
</tr>
</table