This is my code. Onclick of submit, if the answer is correct the value will be saved in database. What I want here is that, when I click on a submit button all other submit buttons in the form must be disabled. Can i do this? Please help me.
<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" value="<?php echo $quest['optiona'];?>"/>
<input type="submit" class="myButton" name="option" value="<?php echo $quest['optionb'];?>" />
<input type="submit" class="myButton" name="option" value="<?php echo $quest['optionc'];?>" />
<input type="submit" class="myButton" name="option" value="<?php echo $quest['optiond'];?>" />
The reason I used submit instead of radio is that i want the value on the button to be displayed over it dynamically.
you can write an
onsubmitevent on your form to disable all buttons.http://jsfiddle.net/4BDaU/1/
2) if you dont want to disable the one clicked, i will suggest use
onclickon buttons to call thehandleSubmit. the code will look like this.you handle function will now accept
thiswhich will be than excluded in the loop.Also note that, you don’t need add
onsubmitin yourformin this case