Note that there are some explanatory texts on larger screens.

plurals
  1. POif checkbox is not checked it should not take its value and error should not be displayed
    primarykey
    data
    text
    <p>i have a coding. In that checkbox may or may not be checked, if it is checked there is no error if the checkbox is not checked then error occurs. can anyone give solution for this this is my html code for checkbox </p> <pre><code>&lt;input name="cb" type="checkbox" id="set_2" value="20"/&gt; Project&lt;td&gt;&lt;i class = "pro_hidden pro_option_set_2"&gt; Included&lt;/i&gt;&lt;/td&gt; </code></pre> <p>If the check box is checked it takes the value 20 and if not checked it will not take the value but it shows <code>Notice: Undefined index: cb</code>I also included javascript if the checkbox is checked it shows included. if not checked it displays nothing...the javascript coding s this</p> <pre><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;/script&gt; &lt;script&gt; $('.pro_hidden').css({ 'display': 'none' }); $(':checkbox').change(function() { var option = 'pro_option_' + $(this).attr('id'); if ($('.' + option).css('display') == 'none') { $('.' + option).fadeIn(); } else { $('.' + option).fadeOut(); } }); &lt;/script&gt; </code></pre> <p>I am trying to add values:</p> <pre><code>&lt;tr&gt; &lt;td&gt;duration&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="duration" values=""&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="radio" name="rd" value="2" required&gt;2hrs&lt;/td&gt; &lt;td&gt;&lt;input type="radio" name="rd" value="4" required&gt;4hrs&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input name="cb" type="checkbox" id="set_2" value="20"&gt; Project&lt;td&gt;&lt;i class = "pro_hidden pro_option_set_2"&gt; 20hrs Included&lt;/i&gt;&lt;/td&gt; &lt;/td&gt; </code></pre> <h2> </h2> <p>this is my entire code if this form is submitted it goes to next page and add the values using php</p> <pre><code> &lt;?php $du=$_POST['duration']; $cb=$_POST['cb']; $c=$_POST['rd']; $sum=($du+$cb)/$c; echo $sum; ?&gt; </code></pre> <p>if checkbox is not checked it displays error here...if the checkbox is not checked how to give coding??</p>
    singulars
    1. This table or related slice is empty.
    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.
    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