JAI MATADI all . .
m trying to send a data inquiry of users selection through checkbox in php in mysql database ..
but i m getting problem in it .. here is my code . .
----------------------------------------------------
mytry.php
--------------------
<form name="f1" method="post" >
<p>Select Your inquiry(s) :
<br />
</p>
<p><br />
<input name="c1[]" type="checkbox" value="inquiry1" />
inquiry1
<input name="c1[]" type="checkbox" value="inquiry2" />
inquiry2
<input name="c1[]" type="checkbox" value="inquiry3" />
inquiry3
<input name="c1[]" type="checkbox" value="inquiry4" />
inquiry4
<br />
<br />
<input type="submit" name="submit" />
</p>
</form>
<?php
if(isset($_POST["submit"]))
{
$box = $_POST['c1'];
while (list ($key,$val) = @each ($box))
{
echo "$val,";
}
}
?>
--------------------------------------------------------------------
m allowing user if he/she can carry on if she/he is not interested to select any inquiry .. but here i m getting problem is that when the user is not selecting any inquiry m getting this error in my webpage..
---------------------------
Notice: Undefined index: c1 in C:\wamp\www\checkboxlist database\page1.php
---------------------------
how could i remove that as i m not able to use ACTION in my form at all .. i have tried this also
---------------------------------
<input type="hidden" name="c1[]" value="" />
---------------------------------
but it is inserting twice / three times as many as i select the available options ..
please tell me how to fix this problem ..
thank you ..
m trying to send a data inquiry of users selection through checkbox in php in mysql database ..
but i m getting problem in it .. here is my code . .
----------------------------------------------------
mytry.php
--------------------
<form name="f1" method="post" >
<p>Select Your inquiry(s) :
<br />
</p>
<p><br />
<input name="c1[]" type="checkbox" value="inquiry1" />
inquiry1
<input name="c1[]" type="checkbox" value="inquiry2" />
inquiry2
<input name="c1[]" type="checkbox" value="inquiry3" />
inquiry3
<input name="c1[]" type="checkbox" value="inquiry4" />
inquiry4
<br />
<br />
<input type="submit" name="submit" />
</p>
</form>
<?php
if(isset($_POST["submit"]))
{
$box = $_POST['c1'];
while (list ($key,$val) = @each ($box))
{
echo "$val,";
}
}
?>
--------------------------------------------------------------------
m allowing user if he/she can carry on if she/he is not interested to select any inquiry .. but here i m getting problem is that when the user is not selecting any inquiry m getting this error in my webpage..
---------------------------
Notice: Undefined index: c1 in C:\wamp\www\checkboxlist database\page1.php
---------------------------
how could i remove that as i m not able to use ACTION in my form at all .. i have tried this also
---------------------------------
<input type="hidden" name="c1[]" value="" />
---------------------------------
but it is inserting twice / three times as many as i select the available options ..
please tell me how to fix this problem ..
thank you ..