Alright so what I'm trying to do is send the form data to the value of whatever checkbox is checked in checkbox_1.
<html>
<head>
<title>Untitled Document</title>
<h1>Student Request Form</h1>
</head>
<body>
<?php
if(isset($_POST['checkbox_1'])) {
$checkbox_1 = implode(",", $_POST['checkbox_1']);
$to=implode(",", $_POST['checkbox_1']);
$subject = "My subject";
$txt = "Hello world!";
mail($to,$subject,$txt);
} else {
$checkbox_1 = "";
}
?>
<?php
if(isset($_POST['checkbox_2'])) {
$checkbox_2 = implode(",", $_POST['checkbox_2']);
} else {
$checkbox_2 = "";
}
?>
<?php
$con = mysqli_connect("localhost","root","admin","form2");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
/*Get Values from form*/
$todays_date="";
if(isset($_POST['todays_date'])){ $todays_date = $_POST['todays_date']; }
$student_fname="";
if(isset($_POST['student_fname'])){ $student_fname = $_POST['student_fname']; }
$student_lname="";
if(isset($_POST['student_lname'])){ $student_lname = $_POST['student_lname']; }
$student_id="";
if(isset($_POST['student_id'])){ $student_id = $_POST['student_id']; }
$phone_number="";
if(isset($_POST['phone_number'])){ $phone_number = $_POST['phone_number'];}
$student_email="";
if(isset($_POST['student_email'])){ $student_email = $_POST['student_email']; }
$course_num1="";
if(isset($_POST['course_num1'])){ $course_num1 = $_POST['course_num1']; }
$course_num2="";
if(isset($_POST['course_num2'])){ $course_num2 = $_POST['course_num2']; }
$course_num3="";
if(isset($_POST['course_num3'])){ $course_num3 = $_POST['course_num3']; }
$section_num1="";
if(isset($_POST['section_num1'])){ $section_num1 = $_POST['section_num1']; }
$section_num2="";
if(isset($_POST['section_num2'])){ $section_num2 = $_POST['section_num2']; }
$section_num3="";
if(isset($_POST['section_num3'])){ $section_num3 = $_POST['section_num3']; }
$request_box="";
if(isset($_POST['request_box'])){ $request_box = $_POST['request_box']; }
$signature="";
if(isset($_POST['signature'])){ $signature = $_POST['signature']; }
$sig_date="";
if(isset($_POST['sig_date'])){ $sig_date = $_POST['sig_date']; }
$request_box="";
if(isset($_POST['request_box'])){ $request_box = $_POST['request_box']; }
if(isset($_POST['submit']))
{
mysqli_query($con,"INSERT INTO student_form(todays_date, student_fname, student_lname, student_id, phone_number, student_email, course_num1, course_num2, course_num3, section_num1, section_num2, section_num3, checkbox_1, checkbox_2, request_box, signature, sig_date) VALUES( '$todays_date','$student_fname','$student_lname', '$student_id','$phone_number','$student_email','$course_num1','$course_num2','$course_num3','$section_num1','$section_num2','$section_num3','$checkbox_1','$checkbox_2','$request_box','signature','sig_date')")
;
}
?>
<form action="index.php" method="post">
<b>Today's Date</b><input name="todays_date" type="text" id="todays_date"><br />
<b>Your Name:</b>
First:<input name="student_fname" type="text" id="student_fname">
Last:<input name="student_lname" type="text" id="student_lname"><br />
<b>Student ID:</b><input name="student_id" type="text" id="student_id"><br />
<b>Phone:</b><input name="phone_number" type="text" id="phone_number"><br />
<b>ITT Email:</b><input name="student_email" type="text" id="student_email">@email.itt-tech<br />
<b>*Responses will only be sent to ITT mailboxes</b>
<br />
<br />
<table border="1" style="width:300px">
<tr>
<th colspan=2 >Course(s) for tutoring Schedule</th>
</tr>
<tr>
<th>Course Number</th>
<th>Section Number</th>
</tr>
<tr>
<td><input name="course_num1" type="text" id="course_num1"></td>
<td><input name="section_num1" type="text" id="section_num1"></td>
</tr>
<tr>
<td><input name="course_num2" type="text" id="course_num2"></td>
<td><input name="section_num2" type="text" id="section_num2"></td>
</tr>
<tr>
<td><input name="course_num3" type="text" id="course_num3"></td>
<td><input name="section_num3" type="text" id="section_num3"></td>
</tr>
</table>
<br />
<h3>I request service from:</h3>
<input name="checkbox_1[]" type="checkbox" value="mpike898@gmail.com" />Dean, Edward Feltis<br />
<input name="checkbox_1[]" type="checkbox" value="RDel_Rosario@itt-tech.edu"/>Associate Dean, Rick Del Rosario<br />
<input name="checkbox_1[]" type="checkbox" value="BSchwartz@itt-tech.edu"/>Associate Dean of General Studies, Dr. Barry Schwartz<br />
<input name="checkbox_1[]" type="checkbox" value="MHawthorne@itt-tech.edu"/>Chair of Business, Michael Hawthorne<br />
<input name="checkbox_1[]" type="checkbox" value="JSinger@itt-tech.edu"/>Chair of Criminal Justice, Justin Singer<br />
<input name="checkbox_1[]" type="checkbox" value="tstangl@itt-tech.edu" />Chair of Electronics Tech, Thomas Stangl<br />
<input name="checkbox_1[]" type="checkbox" value="sclawson@itt-tech.edu" />Chair of information Tech, Shane Clawson<br />
<br />
<h3>I request the following service(Check all that apply):</h3>
<input name="checkbox_2[]" type="checkbox" value="Class Change" />Class Change<br />
<input name="checkbox_2[]" type="checkbox" value="Program Drop"/>Program Drop<br />
<input name="checkbox_2[]" type="checkbox" value="Program Change"/>Program Change<br />
<input name="checkbox_2[]" type="checkbox" value="Class Drop"/>Class Drop<br />
<input name="checkbox_2[]" type="checkbox" value="Campus Transfer"/>Campus Transfer<br />
<input name="checkbox_2[]" type="checkbox" value="Other" />Other<br />
<h3>Detailed reason for this request:</h3>
<textarea name="request_box" id="request_box"rows="8" cols="52">
</textarea>
<br />
<br />
Signature:<input name="signature" type="text" id="signature">
Date:<input name="sig_date" type="text" id="sig_date"><br />
<br />
<br />
<input name="submit" type="submit" value="submit" />
</form>
</body>
</html>
Any suggestions or help would be much appreciated.