Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to pass two (2) values from 1 radio button when clicked?
    primarykey
    data
    text
    <p>I have here a numerous amount of radio buttons and their values are taken from a database. I want to add the type of leave but I can't figure it out. To make myself more clear, once the "Sick" radio button is clicked and when pressing the submit button, the "Sick" credits or the available hours for Sick leave (The value of my radio button which is the (value=$sLeave) and at the same time, the type of leave which is the Sick leave (Hidden type) will be passed to the next page.</p> <p>I tried this one in every type of leave:</p> <pre><code> if($sLeave!=0) { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $sLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Sick"&gt;Sick&lt;/label&gt; &lt;input type="hidden" name"leaveType" value="Sick" /&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Sick"&gt;Sick&lt;/label&gt; &lt;?php } ?&gt; </code></pre> <p>BUT all of the type of leave will be passed to the next page and it outputs the last hidden value. Not the one that is selected.</p> <p>Here's the code:</p> <pre><code>&lt;form id="leaveForm" name="lform" method="get" action="leaveFiled.php" /&gt; if($sLeave!=0) { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $sLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Sick"&gt;Sick&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Sick"&gt;Sick&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($vLeave!=0) { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $vLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Vacation"&gt;Vacation&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Vacation"&gt;Vacation&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($eLeave!=0) { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $eLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Emergency"&gt;Emergency&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Emergency"&gt;Emergency&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($mLeave!=0 &amp;&amp; $sex=='F') { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $mLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Maternity"&gt;Maternity&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Maternity"&gt;Maternity&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($pLeave!=0 &amp;&amp; $sex=='M') { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $pLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Paternity"&gt;Paternity&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Paternity"&gt;Paternity&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($uLeave!=0) { ?&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $uLeave; ?&gt;" onclick="disableTextarea()" /&gt;&lt;label for="Union"&gt;Union&lt;/label&gt; &lt;?php } else { ?&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt;&lt;label for="Union"&gt;Union&lt;/label&gt; &lt;?php } ?&gt; &lt;?php if($oLeave!=0) { ?&gt; &lt;tr&gt; &lt;td height="40" colspan="3" align="left"&gt; &lt;strong&gt; &lt;input type="radio" name="optLeave" value="&lt;?php echo $oLeave; ?&gt;" onclick="enableTextarea()" /&gt; &lt;label for="Other Leave"&gt;Other Leave&lt;/label&gt; &amp;nbsp;&amp;nbsp; &lt;label for="Reason of Leave"&gt;Reason of Leave:&lt;/label&gt; &lt;input type="text" name="reasonLeave" size="35" disabled="disabled" /&gt; &lt;/strong&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } else { ?&gt; &lt;tr&gt; &lt;td height="40" colspan="3" align="left"&gt; &lt;strong&gt; &lt;input type="radio" name="optLeave" disabled="disabled" /&gt; &lt;label for="Other Leave"&gt;Other Leave&lt;/label&gt; &lt;/strong&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; </code></pre> <p>Maybe the use of javascript may solve this problem but I'm hoping for another solution to this.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload