handling multiple submits in php

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']; ?>.&nbsp
         <?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!!!

Answers


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.


Need Your Help

How can I easily transfer my laravel site to Homestead that's running on another computer?

laravel ftp homestead

I want to use my desktop windows computer to edit code but I'd like to use my macbook as the server. Currently I have set up ngrok

Node Express: res.redirect broken when using proxy

node.js express apache2 reverse-proxy passport.js

I have a node express app running behind a proxy, using Apache ProxyPass (configured in httpd.conf):