hai..i have problem.. my problem is when checked radio button and click submit , the radio button not disabled and user can check again . what i want is i want that radio button disabled when click submit. i hope you all can help me....i'm very tension...:'(

Recommended Answers

All 2 Replies

Simply use an if function. Try the following:

echo "<form ...>"; // Just to show the form has started
if (unset($_POST['disableoptiona']))
      {
      //replace the below line with the radio button within the echo ""; function
      echo "<input type=radio name=whatever>";
      // the below line needs to be copied exact if not already in a echo or print function.
      echo "<input type=hidden value='1' name='disableoptiona'>";
      }
//on the below line all you need to do is copy the onclick function
echo "<input type=submit onclick='".$_POST['disableoptiona']."'>";

The last line can be replaced with the following:

?> <input type=submit onclick="<? $_POST['disableoptiona'] ?>">

Let me know if I need to explain in more detail as I often use this myself.

You can call a javascript function on onclick event of submit button like

  <input type="radio"  id="abc">
  <input type="submit" name="submit" value="submit" onclick="returns disradio();">

Javascript function:

   function disradio() 
   { 
      obj=document.getElementById('abc');    
      if(obj.checked=="checked") 
        {
            obj.disabled="disabled";
        }
     return false;
   }

or something like that.you can implement coding like this.may this will be help you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.