您好,我无法让我的复选框值显示在我的电子邮件中。
我环顾四周,厌倦了许多不同的解决方案,似乎都没有奏效。我为我的网站创建了这个应用程序。请帮我解决这个问题。
该表格确实会发送一封电子邮件。信息确实不会出现在复选框中。
这是表单的 html 代码。
<form id="jobapp" name="jobapp" method="post" action="jobappprocess.php">
<p><span class="h2">Personal Information</span></p>
<table width="742" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="121" align="right" valign="middle"><label for="firstname">First Name:</label></td>
<td width="240" align="left" valign="middle"><input name="firstname" type="text" id="firstname" size="30" maxlength="35" /></td>
<td width="106" align="right" valign="middle">Middle Intial:</td>
<td width="241" align="left" valign="middle"><input name="middleintial" type="text" id="middleintial" size="1" maxlength="1" /></td>
</tr>
<tr>
<td align="right" valign="middle">Last Name:</td>
<td align="left" valign="middle"><input name="lastname" type="text" id="lastname" size="30" maxlength="35" /></td>
<td align="right" valign="middle">Social Security
Number:</td>
<td align="left" valign="middle"><input name="ssn" type="text" id="ssn" size="13" maxlength="11" /></td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle"> </td>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle">Street Address:</td>
<td align="left" valign="middle"><input name="streetaddress" type="text" id="streetaddress" size="40" maxlength="90" /></td>
<td align="right" valign="middle">City:</td>
<td align="left" valign="middle"><input name="city" type="text" id="city" size="40" maxlength="90" /></td>
</tr>
<tr>
<td align="right" valign="middle"><label for="zipcode2">Zip Code</label></td>
<td align="left" valign="middle"><input name="zipcode" type="text" id="zipcode" size="7" maxlength="5" /></td>
<td align="right" valign="middle">State:</td>
<td align="left" valign="middle"><input name="state" type="text" id="state" size="2" maxlength="2" /></td>
</tr>
<tr>
<td align="right" valign="middle"><p>Previous Address<br />
</p></td>
<td align="left" valign="middle"><input name="previousaddress" type="text" id="previousaddress" size="40" maxlength="90" /></td>
<td colspan="2" align="right" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle">Home Phone:</td>
<td align="left" valign="middle"><input name="homephone" type="text" id="homephone" size="15" maxlength="13" /></td>
<td align="right" valign="middle">Mobile Phone:</td>
<td align="left" valign="middle"><input name="mobilephone" type="text" id="mobilephone" size="15" maxlength="13" /></td>
</tr>
<tr>
<td align="right" valign="middle"><label for="emailaddress">Email Address</label>
: </td>
<td align="left" valign="middle"><input name="emailaddress" type="text" id="emailaddress" size="35" maxlength="40" /></td>
<td colspan="2" align="right" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle">Are you 18 years of age or older?</td>
<td align="left" valign="middle"><label>
<input type="radio" name="areyou18[]" value="Yes" id="areyou18" />
Yes</label>
<br />
<label>
<input type="radio" name="areyou18[]" value="No" id="areyou18" />
No</label></td>
<td colspan="2" align="right" valign="middle"> </td>
</tr>
</table>
<p class="h2">Position Desired</p>
<table width="850" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="218" align="right" valign="middle"><label for="positiondesired">What positon are you applying for?</label></td>
<td width="218" align="left" valign="middle"><input name="positiondesired" type="text" id="positiondesired" size="30" maxlength="30" /></td>
<td width="228" align="right"><label for="startdate">What date are you available to start?</label></td>
<td width="150" align="left" valign="middle"><input name="startdate" type="text" id="startdate" size="20" maxlength="10" /></td>
</tr>
<tr>
<td align="right" valign="middle">Type of Employment:</td>
<td align="left" valign="middle"><p>
<label>
<input type="radio" name="typeofemployment[]" value="Full-time" id="TypeofEmployment_0" />
Full-time</label>
<br />
<label>
<input type="radio" name="typeofemployment[]" value="Part-time" id="TypeofEmployment_1" />
Part-time</label>
<br />
</p></td>
<td align="right">Days Available for work:</td>
<td align="left" valign="middle"><p>
<input type="checkbox" name="sunday[]" id="sunday" />
<label for="sunday">sun</label>
</p>
<p>
<input type="checkbox" name="monday[]" id="monday" />
<label for="monday[]">mon</label>
</p>
<p>
<input type="checkbox" name="tuesday[]" id="tuesday" />
<label for="tuesday">tue</label>
</p>
<p>
<input type="checkbox" name="wednesday[]" id="wednesday" />
<label for="wednesday">wed</label>
</p>
<p>
<input type="checkbox" name="thursday[]" id="thursday" />
<label for="thursday">thur</label>
</p>
<p>
<input type="checkbox" name="friday[]" id="friday" />
<label for="friday">fri</label>
</p>
<p>
<input type="checkbox" name="saturday[]" id="saturday" />
<label for="saturday">sat</label>
<br />
</p></td>
</tr>
</table>
<p class="h2">Education</p>
<table width="850" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td align="right" valign="middle"><label for="highschool">High School:</label></td>
<td align="left" valign="middle"><input name="highschool" type="text" id="highschool" size="50" maxlength="50" /></td>
<td align="right" valign="middle"><label for="hsdatesattended">Dates Attended:</label></td>
<td align="left" valign="middle"><input name="hsdatesattended" type="text" id="hsdatesattended" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right" valign="middle">Did you Graduate?</td>
<td align="left" valign="middle"><label>
<input type="checkbox" name="hsgraduate[]" value="Yes" id="Graduate_0" />
Yes</label>
<br />
<label>
<input type="checkbox" name="hsgraduate[]" value="No" id="Graduate_1" />
No</label></td>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle"><label for="college2">College or University:</label></td>
<td align="left" valign="middle"><input name="college" type="text" id="college" size="50" maxlength="60" /></td>
<td align="right" valign="middle">Dates Attended:</td>
<td align="left" valign="middle"><input name="collegedates" type="text" id="collegedates" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right" valign="middle"><label for="achievements2">Achievements: List your degrees, certificates, and awards, if any.</label></td>
<td align="left" valign="middle"><textarea name="achievements" id="achievements" cols="30" rows="3"></textarea></td>
<td align="right" valign="middle">Did you Graduate?</td>
<td align="left" valign="middle"><input type="checkbox" name="collegegradyes[]" id="yes" />
<label for="yes">yes<br />
<input type="checkbox" name="collegegradno[]" id="no" />
no </label></td>
</tr>
<tr>
<td align="right" valign="middle"><p> </p></td>
<td align="left" valign="middle"><p><br />
</p></td>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle">Have you served as a member of the U.S. Armed Forces?</td>
<td align="left" valign="middle"><label>
<input type="checkbox" name="armedforces[]" value="Yes" id="armedforces" />
Yes</label>
<br />
<label>
<input type="checkbox" name="armedForces[]" value="No" id="armedforces" />
No</label></td>
<td align="right" valign="middle"> </td>
<td align="left" valign="middle"> </td>
</tr>
<tr>
<td align="right" valign="middle">Branch/Services:</td>
<td align="left" valign="middle"><input name="afbranch" type="text" id="afbranch" size="30" maxlength="25" /></td>
<td align="right" valign="middle">Rank/Speciaty</td>
<td align="left" valign="middle"><input name="afrank" type="text" id="afrank" size="30" maxlength="25" /></td>
</tr>
</table>
<p class="h2"> Work Experience</p>
<table width="850" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td width="99" align="right"><label for="presentlastemployer">Present or Last Employer:</label></td>
<td width="287" align="left"><input name="presentlastemployer" type="text" id="presentlastemployer" size="40" maxlength="30" /></td>
<td width="127" align="right"><label for="plphone">Telephone:</label></td>
<td width="150" align="left"><input name="plphone" type="text" id="plphone" size="15" maxlength="13" /> </td>
</tr>
<tr>
<td align="right"><label for="pladdress">Street Address:</label></td>
<td align="left"><input name="pladdress" type="text" id="pladdress" size="40" maxlength="90" /></td>
<td align="right"><label for="plcity">City:</label></td>
<td align="left"><input name="plcity" type="text" id="plcity" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right">State:</td>
<td align="left"><input name="plstate" type="text" id="plstate" size="2" maxlength="2" /></td>
<td align="right">Zip Code:</td>
<td align="left"><input name="plzipcode" type="text" id="plzipcode" size="7" maxlength="5" /></td>
</tr>
<tr>
<td align="right">Position Held:</td>
<td align="left"><input name="plposition" type="text" id="plposition" size="30" maxlength="30" /></td>
<td align="right">Dates of Employment:</td>
<td align="left"><input name="pldates" type="text" id="pldates" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right">Job Description:</td>
<td align="left"><textarea name="pldescription" id="pldescription" cols="45" rows="5"></textarea></td>
<td align="right">Supervisor:</td>
<td align="left"><input name="plsupervisor" type="text" id="plsupervisor" size="40" maxlength="35" /></td>
</tr>
<tr>
<td align="right">Reason for Leaving:</td>
<td align="left"><p>
<textarea name="plreasonforleaving" id="plreasonforleaving" cols="45" rows="5"></textarea>
<br />
</p></td>
<td align="right">Salary:</td>
<td align="left"><input name="plsalary" type="text" id="plsalary" size="20" maxlength="15" /></td>
</tr>
<tr>
<td align="right">May we contact your present employer?</td>
<td align="left"><label>
<input type="checkbox" name="plmaywecontact[]" value="Yes" id="plmaywecontact" />
Yes</label>
<br />
<label>
<input type="checkbox" name="plmaywecontact[]" value="No" id="plmaywecontact" />
No</label></td>
<td align="right"> </td>
<td align="right"> </td>
</tr>
<tr>
<td colspan="4" align="center" class="h2"> More Work Experience</td>
</tr>
<tr>
<td align="right">Previous Employer:</td>
<td align="left"><input name="previousemployer" type="text" id="previousemployer" size="40" maxlength="30" /></td>
<td align="right">Telephone:</td>
<td align="left"><input name="pephone" type="text" id="pephone" size="15" maxlength="13" /></td>
</tr>
<tr>
<td align="right"><label for="peaddress2">Address:</label></td>
<td align="left"><input name="peaddress" type="text" id="peaddress" size="40" maxlength="50" /></td>
<td align="right">City:</td>
<td align="left"><input name="pecity" type="text" id="pecity" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right">State:</td>
<td align="left"><input name="pestate" type="text" id="pestate" size="2" maxlength="2" /></td>
<td align="right">Zip Code:</td>
<td align="left"><input name="pezipcode" type="text" id="pezipcode" size="7" maxlength="5" /></td>
</tr>
<tr>
<td align="right">Position Held:</td>
<td align="left"><input name="peposition" type="text" id="peposition" size="30" maxlength="20" /></td>
<td align="right">Dates of Employment:</td>
<td align="left"><input name="pedates" type="text" id="pedates" size="30" maxlength="25" /></td>
</tr>
<tr>
<td align="right">Job description:</td>
<td align="left"><textarea name="pedescription" id="pedescription" cols="45" rows="5"></textarea></td>
<td align="right">Supervisor</td>
<td align="left"><input name="pesupervisor" type="text" id="pesupervisor" size="35" maxlength="30" /></td>
</tr>
<tr class="agree">
<td align="right">Reason for leaving:</td>
<td align="center" class="agree"><textarea name="peresasonforleaving" id="peresasonforleaving" cols="45" rows="5"></textarea></td>
<td align="right" class="agree">Salary:</td>
<td align="left" class="agree"><input type="text" name="pesalary" id="pesalary" /></td>
</tr>
</table>
<p> </p>
<table width="500" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2"><span class="agree"></span></td>
</tr>
<tr>
<td width="362" align="center"><span class="h2">Do you accept the terms of this application?</span></td>
<td width="120"><span class="h2">
<label>
<input type="radio" name="acceptterms[]" value="Yes" id="AcceptTermsofapplication_0" />
Yes</label>
<br />
<label>
<input type="radio" name="acceptterms[]" value="No" id="AcceptTermsofapplication_1" />
No</label>
</span></td>
</tr>
<tr>
<td colspan="2" align="center"><input name="submitapp" type="submit" id="Submit Application" onclick="MM_validateForm('firstname','','R','lastname','','R','ssn','','RisNum','streetaddress','','R','city','','R','zipcode','','RisNum','state','','R','homephone','','RisNum','mobilephone','','RisNum','emailaddress','','RisEmail','positiondesired','','R','startdate','','RisNum','highschool','','R','presentlastemployer','','R','pladdress','','R','plstate','','R','plposition','','R','pldates','','R','plsupervisor','','R','plsalary','','NisNum','pephone','','NisNum','pezipcode','','NisNum','pedates','','NisNum','pesalary','','NisNum','pldescription','','R','plreasonforleaving','','R');return document.MM_returnValue" value="Submit Application" /></td>
</tr>
</table>
<p class="h2"> </p>
<p class="h2"> </p>
</form></td>
</tr>
</table>
这是php代码
<?php
foreach ($_SESSION['Checkbox'] as $val) {
$checkboxresults .= $val.",\n";
}
echo (is_array($_REQUEST['$checkbox']) ? implode("\n", $_REQUEST['$checkbox']) : $_REQUEST['$checkbox']);
/* Subject and Email Variables */
$emailSubject = 'New Job Appilcant!';
$webMaster = '';
$from = 'emailaddressField';
/* Gathering Data Variables */
$firstnameField = $_POST['firstname'];
$lastnameField = $_POST['lastname'];
$middleintialField = $_POST['middleintial'];
$streetaddressField = $_POST['streetaddress'];
$cityField = $_POST['city'];
$stateField = $_POST['state'];
$zipcodeField = $_POST['zipcode'];
$ssnField = $_POST['ssn'];
$previousaddressField = $_POST['previousaddress'];
$homephoneField = $_POST['homephone'];
$mobilephoneField = $_POST['mobilephone'];
$emailaddressField = $_POST['emailaddress'];
$areyou18Field = $_POST['areyou18'];
$positiondesiredField = $_POST['positiondesired'];
$startdateField = $_POST['startdate'];
$typeofemploymentField = $_POST['typeofemployment'];
$sundayField = $_POST ['sunday'];
$mondayField = $_POST ['monday'];
$tuesdayField = $_POST ['tuesday'];
$wednesdayField = $_POST ['wednesday'];
$thursdayField = $_POST ['thursday'];
$fridayField = $_POST ['friday'];
$saturdayField = $_POST ['saturday'];
$highschoolField = $_POST['highschool'];
$hsdatesattendedField = $_POST['hsdatesattended'];
$hsgraduateField = $_POST['hsgraduate'];
$collegeField = $_POST['college'];
$collegedatesField = $_POST['collegedates'];
$collegegradyesField = $_POST['collegegradyes'];
$collegegradnoField = $_POST['collegegradno'];
$achievementsField = $_POST['achievements'];
$armedforcesField = $_POST['armedforces'];
$afbranchField = $_POST['afbranch'];
$afrankField = $_POST['afrank'];
$previouslastemployerField = $_POST['previouslastemployer'];
$plphoneField = $_POST['plphone'];
$pldatesField = $_POST['pldates'];
$pladdressField = $_POST['pladdress'];
$plcityField = $_POST['plcity'];
$plstateField = $_POST['plstate'];
$plzipcodeField = $_POST['plzipcode'];
$plsupervisorField = $_POST['plsupervisor'];
$plpositionField = $_POST['plposition'];
$pldescriptionField = $_POST['pldescription'];
$plsalaryField = $_POST['plsalary'];
$plreasonforleavingField = $_POST['plreasonforleaving'];
$maywecontactField = $_POST['maywecontact'];
$previousemployerField = $_POST['previousemployer'];
$pephoneField = $_POST['pephone'];
$pedatesField = $_POST['pedates'];
$peaddressField = $_POST['peaddress'];
$pecityField = $_POST['pecity'];
$pestateField = $_POST['pestate'];
$pezipcodeField = $_POST['pezipcode'];
$pesupervisorField = $_POST['pesupervisor'];
$pepositionField = $_POST['peposition'];
$pedescriptionField = $_POST['pedescription'];
$pesalaryField = $_POST['pesalary'];
$pereasonforleavingField = $_POST['acceptterms'];
$body = <<<EOD
<br><hr><br>
<p>
Name: $firstnameField $middleintialField $lastnameField <br><br>
Address: $streetaddressField $cityField $stateField $zipcodeField <br><br>
SSN: $ssnField <br><br>
Previous Address: $previousaddressField <br><br>
Home Phone: $homephoneField <br><br>
Mobile Phone: $mobilephoneField <br><br>
Email: $emailaddressField <br><br>
Eight-teen Plus: $areyou18Field <br><br>
Position Desired: $positiondesiredField <br><br>
Date available to start: $startdateField <br><br>
Type of Employment: $typeofemploymentField <br><br>
Days available to work: $sundayField, $mondayField, $tuesdayField, $wednesdayField, $thursdayField, $fridayField, $saturdayField
<br><hr><br>
High School: $highschoolField, $hsdatesattenedField, $hsgraduateField
<br><hr><br>
College: $collegeField, $collegedatesField, $collegegradyesField, $collegegradnoField, $achievements
<br><hr><br>
Armed Forces: $armedforcesField, $afbranchField, $afrankField
<br><hr><br>
Recent Employer <br>
<p>
$presentlastemployerField
$plphoneField
$pldatesField
$pladdressField
$plcityField
$plstateField
$plzipcodeField
$supervisorField
$plpositionField
$pldescriptionField
$plsalaryField
$plreasonforleavingField
$plmaywecontactField</p>
<br><hr><br>
Previous Employer <br>
<p>
$previousemployerField
$pephoneField
$pedatesField
$peaddressField
$pecityField
$pestateField
$pezipcodeField
$pesupervisorField
$pepositionField
$pedescriptionField
$pesalaryField
$pereasonforleavingField</p>
<br><hr><br>
Accept Terms of Employment <br><br>
$accepttermsField
EOD;
$headers = "From: $emailaddressField\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail ($webMaster, $emailSubject, $body, $headers);
?>
正如我所说,表格确实提交了。复选框值不会出现。提前感谢您提供的任何帮助。