Welcome Guest, Not a member yet? Register   Sign In
my radio button not working properly?
#1

Code:
<input type="radio" name="kvr"  checked="checked" onclick="hideall1();showit1('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="yes") echo "checked";?> value="yes"  >Same &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;

<input type="radio" name="kvr" onclick="hideall();showit('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="no") echo "checked";?> value="no" >Other

at first radio button click the form should not be submitted, after click second radio button  the value only be passed. why? need suggestion
Reply
#2

(This post was last modified: 11-15-2018, 08:12 AM by ciadmin.)

<input type="radio" name="kvr"  checked="checked" onclick="hideall1();showit1('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="yes") echo "checked";?> value="yes"  >Same &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;

<input type="radio" name="kvr" onclick="hideall();showit('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="no") echo "checked";?> value="no" >Other

-----------------------

remove checked="checked" from first line
Reply
#3

(11-15-2018, 05:00 AM)abGorad Wrote: <input type="radio" name="kvr"  checked="checked" onclick="hideall1();showit1('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="yes") echo "checked";?> value="yes"  >Same &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;

<input type="radio" name="kvr" onclick="hideall();showit('x1')"  <?php if (isset($_POST['kvr']) && $_POST['kvr']=="no") echo "checked";?> value="no" >Other

-----------------------

remove checked="checked" from first line

default first radio button should be checked when loading form.
Reply
#4

Reading this question, I wonder why you keep ignoring the numerous advices that I and others have given you about the CI fundamentals, form validation library, form helper and jQuery. Why asking questions in a CI forum if you intend to stick to traditional php and javascript anyway???
Reply
#5

(11-15-2018, 04:16 AM)kvanaraj Wrote: after click second radio button  the value only be passed. why?
If you are asking "Why is it only the value of the second radiobutton gets passed?"

If these are in a radiogroup. Only one radio button within the same radiogroup may be selected at a time. Only the value of the selected radio button will be sent to the server.

If you want multiple values you should probably be using checkbox.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB