I have made an ajax based form for the website, it takes input from the user and sends it to the database. All fields are working fine but there is a problem with the radio buttons in sending the values.
My code for the ajax is
<script type="text/javascript">
function emp1() {
.....................
xmlhttp.send("firstname=" + firstname.value + "&lastname=" + lastname.value + "&company=" + company.value
+ "&myemail=" + myemail.value
+ "&address=" + address.value
+ "&city=" + city.value
+ "&province=" + province.value
+ "&postalcode=" + postalcode.value
+ "&country=" + country.value
+ "&contact=" + contact.value
+ "&radio1=" + radio1.value
+ "&paymentmethod=" + paymentmethod.value
);
}
code for html form for radio buttons is
<input type="radio" name="radio1" id="radio1" value="Free Shipping" onclick="emp1();"> Free Shipping<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="abc" onclick="emp1();">abc
<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="def" onclick="emp1();" onchange="emp1();">def
<br />
<input type="radio" name="paymentmethod" id="paymentmethod" value="ghi" onclick="emp1();">ghi
Any help … ..
thnx in advance
You can use something like this to get selected radio button vlaue using javascript inside your
emp1()function. it will give you selected radio button value.