I need to send two parameter to my javascript and get the parameters in the php file how I can do it ?
My html :
<form method="post" action="testButtonSup.php">
<p>
Veuillez choisir le service<br />
<input type="radio" name="service" value="ncli" id="ncli" checked ="checked" /> <label for="ncli">Ncli</label>
<input type="radio" name="service" value="fcli" id="fcli" /> <label for="fcli">Fcli</label>
</p>
<p>
<label for="client">Veuillez choisir le fournisseur :</label><br />
<select name="client" id="client" onchange="showUser(this.value, service)">
<?php
// echo '<option value=""/></option>';
while ($donnees = $reponse->fetch())
{
echo '<option value='.$donnees['refCustomer'].'>'.$donnees['legalCompanyName'].' </option>';
$idClient = $donnees['refCustomer'];
//$value = $donnees['refCustomer'];
}
$reponse->closeCursor();
?>
</select>
</p>
<p>.....
I want to send to the function showUser(this.value, service) two parameters : the id of the select and the value of the radio button "service" whic is up
My function :
function showUser(str, service) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET","getTableBuffer.php?q="+str+"&service="service,true);
xmlhttp.send();
}
}
I tried like this but it doesn't work.
in my php file it didn't recognize the parameter.
It works with only the id of the select.