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...:'(

10 Years
Discussion Span
Last Post by phpuser

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() 
     return false;

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

Edited by Nick Evan: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.