Ok my problem is I already success make a form with multiple check box. When I submit form it successfully goes to my mysql database. But the funny thing is on my run screen it's shows error like this.

Notice: Undefined index: kursusa3 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 15

Notice: Undefined index: kursusa5 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 17

Notice: Undefined index: kursusa6 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 18

Notice: Undefined index: kursusb3 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 22

Notice: Undefined index: kursusb4 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 23

Notice: Undefined index: kursusb5 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 24

Notice: Undefined index: kursusb6 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 25

Notice: Undefined index: kursusb7 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 26

Notice: Undefined index: kursusb8 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 27

Notice: Undefined index: kursusb9 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 28

Notice: Undefined index: kursusc3 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 32

Notice: Undefined index: kursusc4 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 33

Notice: Undefined index: kursusc5 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 34

Notice: Undefined index: kursusc6 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 35

Notice: Undefined index: kursusc7 in c:\program files\easyphp1-8\www\ctlcourseapply\insert_application.php on line 36
Thank you for your interest in our course/training modules.
We will contact you to confirm the course/training date.
If you have any questions or need more information, please e-mail or call our office.

Click to go back

======================================================

Ok down here is my php code. Can somebody suggest to me how I'm gonna adjust the code so that undeine thing will not showout?

========================================================


<? $name = $_POST["name"]; ?>
<? $title = $_POST["title"]; ?>
<? $faculty = $_POST["faculty"]; ?>
<? $staffno = $_POST["staffno"]; ?>
<? $teloffice = $_POST["teloffice"]; ?>
<? $telhp = $_POST["telhp"]; ?>
<? $email = $_POST["email"]; ?>
<? $day = $_POST["day"]; ?>
<? $month = $_POST["month"]; ?>
<? $year = $_POST["year"]; ?>

<? $kursusa1 = $_POST["kursusa1"]; ?>
<? $kursusa2 = $_POST["kursusa2"]; ?>
<? $kursusa3 = $_POST["kursusa3"]; ?>
<? $kursusa4 = $_POST["kursusa4"]; ?>
<? $kursusa5 = $_POST["kursusa5"]; ?>
<? $kursusa6 = $_POST["kursusa6"]; ?>

<? $kursusb1 = $_POST["kursusb1"]; ?>
<? $kursusb2 = $_POST["kursusb2"]; ?>
<? $kursusb3 = $_POST["kursusb3"]; ?>
<? $kursusb4 = $_POST["kursusb4"]; ?>
<? $kursusb5 = $_POST["kursusb5"]; ?>
<? $kursusb6 = $_POST["kursusb6"]; ?>
<? $kursusb7 = $_POST["kursusb7"]; ?>
<? $kursusb8 = $_POST["kursusb8"]; ?>
<? $kursusb9 = $_POST["kursusb9"]; ?>

<? $kursusc1 = $_POST["kursusc1"]; ?>
<? $kursusc2 = $_POST["kursusc2"]; ?>
<? $kursusc3 = $_POST["kursusc3"]; ?>
<? $kursusc4 = $_POST["kursusc4"]; ?>
<? $kursusc5 = $_POST["kursusc5"]; ?>
<? $kursusc6 = $_POST["kursusc6"]; ?>
<? $kursusc7 = $_POST["kursusc7"]; ?>
<? $kursusc8 = $_POST["kursusc8"]; ?>


<? $comment = $_POST["comment"]; ?>


<?php

$con = mysql_connect("localhost","root","horatiocsi");

if (!$con)
{
die('Could not connect: ' . mysql_error());
}


mysql_select_db("ctlcourse", $con);

mysql_query("INSERT INTO application (name, title, faculty, staffno, teloffice, telhp, email, day, month, year, kursusa1, kursusa2, kursusa3, kursusa4, kursusa5, kursusa6, kursusb1, kursusb2, kursusb3, kursusb4, kursusb5, kursusb6, kursusb7, kursusb8, kursusb9, kursusc1, kursusc2, kursusc3, kursusc4, kursusc5, kursusc6, kursusc7, kursusc8,comment )
VALUES ('$name','$title','$faculty','$staffno','$teloffice','$telhp','$email','$day','$month','$year','$kursusa1','$kursusa2','$kursusa3','$kursusa4','$kursusa5','$kursusa6','$kursusb1','$kursusb2','$kursusb3','$kursusb4','$kursusb5','$kursusb6','$kursusb7','$kursusb8','$kursusb9','$kursusc1','$kursusc2','$kursusc3','$kursusc4','$kursusc5','$kursusc6','$kursusc7','$kursusc8','$comment')");

echo "Thank you for your interest in our course/training modules.";
echo "<br>";
echo "We will contact you to confirm the course/training date.";
echo "<br>";
echo "If you have any questions or need more information, please e-mail or call our office.";

echo "<p><a href=index.htm>Click to go back</a></p>";


mysql_close($con);
?>

In your html use:

<input type="checkbox" name="array[]" value="1" />

Now the checked checkboxes values are in an array in the variable $array. Use this php code to read them.

<?php
foreach($array as $var) {
//do what you want to with $var
}
?>

Or you could use a while statement to loop through them.

If you want an expample: go to www.banditssoftball.org/test.php and mess around with that.

Hope it helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.