This is my code.
<?php
$qry5=mysql_query("SELECT * FROM `questions` WHERE `questnTime`=curdate()");
$quest=mysql_fetch_array($qry5);
?>
<form id="form" name="form" action="">
<textarea name="questn" id="questn" readonly="readonly" cols="45" rows="5">
<?php echo $quest['questnId']; ?>. 
<?php echo $quest['question'];?>
</textarea>
<input type="submit" class="myButton" name="option"
onclick="handleSubmit(this)" value="<?php echo $quest['optiona'];?>"/>
<input type="submit" class="myButton" name="option"
onclick="handleSubmit(this)" value="<?php echo $quest['optionb'];?>"/>
<input type="submit" class="myButton" name="option"
onclick="handleSubmit(this)" value="<?php echo $quest['optionc'];?>"/>
<input type="submit" class="myButton" name="option"
onclick="handleSubmit(this)" value="<?php echo $quest['optiond'];?>"/>
</form>
<?php
if($quest['answer']==$_GET['option']){
$option=$_GET['option'];
}
Javascript code:
<script type="text/javascript">
function handleSubmit(current){
var list = document.getElementsByName('option');
for(var i=0;i<list.length;i++){
if(list[i]!=current)
list[i].disabled=true;
}
alert('all disabled');
}
</script>
CSS:
<style>
input.myButton{
background-image: url('option.png');
background-color:#FFF;
height:32;
width:32;
border-style:hidden;
color: #FFFFFF;
}
</style>
What I require is when user clicks on an option all other options must be disabled. When an option is clicked, I want to get the value. Also I dont want the page to be refreshed. How to do this? The following code dosenot disable the options. Please help me!!!
In this case not make multiple submits put them as a button and when clicked then make all disable except clicked one and change input type as submit.