会社にメールを送信する前に、このフォームを検証しようとしています。フォームは検証されず、誰かが[送信]をクリックするたびに送信されます。検証は行われていません。これについてどうしたらよいかわかりません。
これがフォームの一部です
<tr>
<td><label for="reason3">Reason for Leaving?</label></td>
<td><input type="text" id="reason3" name="reason3" class="c3"></td>
</tr>
<tr>
<td colspan="2">
<hr size="1.5" color="#000000" noshade></td>
</tr>
<tr>
<td><label for="maywe">May we contact the employers listed above?<br>
If not, indicate which you do not wish us to contact:</label></td>
<td><input type="text" id="maywe" name="maywe" class="c3"></td>
</tr>
<tr>
<td><label for="additional">Any additonal information you would like us to<br>
consider when reviewing your application?</label></td>
<td><input type="text" id="additional" name="additional" class="c3"></td>
</tr>
<tr>
<td colspan="2">
<hr size="1.5" color="#000000" noshade></td>
</tr>
<tr>
<td colspan="2">
<div class="c2">
<hr size="1.5" color="#000000" noshade>
The above information is true and complete to the best of my knowledge. Should I become<br>
employed by <a href="http://www.creativeurethanes.com/">Creative Urethanes, Inc.,</a> any false statements on this application may be<br>
considered sufficient cause for dismissal.<br>
I understand that filling out this application does not indicate that there are necessarily any<br>
vacant positions at this time, nor does it in any way obligate this Company.<br>
I acknowledge that I have read Creative Urethanes' <a href="Memo.html">Memo on Right to Know</a>. <input type="checkbox" name="Yes" value="Yes"><span class="c1"><sup><i>*</i></sup></span><br>
<br></div>
</td>
</tr>
<tr>
<td colspan="2">
<hr size="1.5" color="#000000" noshade></td>
</tr>
<tr>
<td colspan="2">Sign electronically with your full name and SSN.</td>
</tr>
<tr>
<td><label for="electronicsignfn"><u>Full</u> <u>Name</u><span class="c1"><sup><i>*</i></sup></span></label></td>
<td><input type="text" id="electronicsignfn" name="electonicsignfn" class="c3"></td>
</tr>
<tr>
<td><label for="electronicsignssn"><u>S.S.N.</u><span class="c1"><sup><i>*</i></sup></span></label></td>
<td><input type="text" id="electronicsignssn" name="electronicsignssn" class="c3"></td>
</tr>
<tr>
<td><label for="emailaddress"><u>Email</u> <u>Address</u><span class="c1"><sup><i>*</i></sup></span></label></td>
<td><input type="text" id="emailaddress" name="emailaddress"></td>
</tr>
<tr>
<td colspan="2">
<hr size="1.5" color="#000000" noshade></td>
</tr>
<tr>
<td><input type="submit" id="field89" name="field89" class="c3" value="Submit"></td>
<td><input type="reset" id="field90" name="field90" class="c3" value="Reset"></td>
</tr>
</table>
</form>
</body>
</html>
これがphpです
<?php
if ($_POST['submitted']==1) {
$errormsg = "";
if ($_POST[first_name]){
$first_name = $_POST[first_name];
}
else{
$errormsg = "Please enter your first name";
}
if ($_POST[last_name]){
$last_name = $_POST[last_name];
}
else{
$errormsg = "Please enter your last name";
}
if ($_POST[ssn]){
$ssn = $_POST[ssn];
}
else{
$errormsg = "Please enter your Social Security Number";
}
if ($_POST[phone]){
$phone = $_POST[phone];
}
else{
$errormsg = "Please enter your phone number";
}
if ($_POST[address]){
$address = $_POST[address];
}
else{
$errormsg = "Please enter your address";
}
if ($_POST[city]){
$city = $_POST[city];
}
else{
$errormsg = "Please enter your city";
}
if ($_POST[state]){
$state = $_POST[state];
}
else{
$errormsg = "Please select your state";
}
if ($_POST[zip]){
$zip = $_POST[zip];
}
else{
$errormsg = "Please enter your 5 digit zip code";
}
if ($_POST[position]){
$position = $_POST[position];
}
else{
$errormsg = "Please enter N/A if open for discussion";
}
if ($_POST[wage]){
$wage = $_POST[wage];
}
else{
$errormsg = "Please enter 0.00 if open for discussion";
}
if ($_POST[Emergencycontactname]){
$Emergencycontactname = $_POST[Emergencycontactname];
}
else{
$errormsg = "Please enter your emergency contact's name";
}
if ($_POST[Emergencycontactaddress]){
$Emergencycontactaddress = $_POST[address];
}
else{
$errormsg = "Please enter your emergency contact's address";
}
if ($_POST[Emergencycontactcity]){
$Emergencycontactcity = $_POST[Emergencycontactcity];
}
else{
$errormsg = "Please enter your emergency contact's city";
}
if ($_POST[Emergencycontactstate]){
$Emergencycontactstate = $_POST[Emergencycontactstate];
}
else{
$errormsg = "Please select your Emergency contact's state";
}
if ($_POST[Emergencycontactzip]){
$Emergencycontactzip = $_POST[Emergencycontactzip];
}
else{
$errormsg = "Please enter your emergency contact's 5 digit zip code";
}
if ($_POST[Emergencycontactphone]){
$Emergencycontactphone = $_POST[Emergencycontactphone];
}
else{
$errormsg = "Please enter your emergency contact's phone number";
}
if ($_POST[hightest]){
$highest = $_POST[highest];
}
else{
$errormsg = "Please enter your highest level of education";
}
if ($_POST[degree]){
$degree = $_POST[degree];
}
else{
$errormsg = "Please enter N/A if none";
}
if ($_POST[age]){
$age = $_POST[age];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[problems]){
$problems = $_POST[problems];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[shiftwork]){
$shiftwork = $_POST[shiftwork];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[apprenticeship]){
$apprenticeship = $_POST[apprenticeship];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[disabilities]){
$disabilities = $_POST[disabilities];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[ifyes]){
$ifyes = $_POST[ifyes];
}
else{
$errormsg = "if you answered no to above question, put N/A";
}
if ($_POST[accommodate]){
$accommodate = $_POST[accommodate];
}
else{
$errormsg = "if you answered N/A to above question, put N/A";
}
if ($_POST[experience]){
$experience = $_POST[experience];
}
else{
$errormsg = "Please enter yes or no";
}
if ($_POST[ifyes2]){
$ifyes2 = $_POST[ifyes2];
}
else{
$errormsg = "if you answered no to above question, put N/A";
}
if ($_POST[cname]){
$cname = $_POST[cname];
}
else{
$errormsg = "Please enter company name";
}
if ($_POST[caddress]){
$caddress = $_POST[caddress];
}
else{
$errormsg = "Please enter company address";
}
if ($_POST[cphone]){
$cphone = $_POST[cphone];
}
else{
$errormsg = "Please enter company phone number";
}
if ($_POST[ccperson]){
$ccperson = $_POST[ccperson];
}
else{
$errormsg = "Please enter contact person's name";
}
if ($_POST[ctype]){
$ctype = $_POST[ctype];
}
else{
$errormsg = "Please enter type of work";
}
if ($_POST[cwage]){
$cwage = $_POST[cwage];
}
else{
$errormsg = "Please enter wage earned";
}
if ($_POST[cstart]){
$cstart = $_POST[cstart];
}
else{
$errormsg = "Please enter date started";
}
if ($_POST[cend]){
$cend = $_POST[cend];
}
else{
$errormsg = "Please enter date ended";
}
if ($_POST[creason]){
$creason = $_POST[creason];
}
else{
$errormsg = "Please enter reason for leaving";
}
if ($_POST[cname2]){
$cname2 = $_POST[cname2];
}
else{
$errormsg = "Please enter company name, or type N/A";
}
if ($_POST[caddress2]){
$caddress2 = $_POST[caddress2];
}
else{
$errormsg = "Please enter company address, or type N/A";
}
if ($_POST[cphone2]){
$cphone2 = $_POST[cphone2];
}
else{
$errormsg = "Please enter company phone number, or type N/A";
}
if ($_POST[ccperson2]){
$ccperson2 = $_POST[ccperson2];
}
else{
$errormsg = "Please enter contact person's name, or type N/A";
}
if ($_POST[ctype2]){
$ctype2 = $_POST[ctype2];
}
else{
$errormsg = "Please enter type of work, or type N/A";
}
if ($_POST[cwage2]){
$cwage2 = $_POST[cwage2];
}
else{
$errormsg = "Please enter wage earned, or type N/A";
}
if ($_POST[cstart2]){
$cstart2 = $_POST[cstart2];
}
else{
$errormsg = "Please enter date started, or type N/A";
}
if ($_POST[cend2]){
$cend2 = $_POST[cend2];
}
else{
$errormsg = "Please enter date ended, or type N/A";
}
if ($_POST[creason2]){
$creason2 = $_POST[creason2];
}
else{
$errormsg = "Please enter reason for leaving, or type N/A";
}
if ($_POST[cname3]){
$cname3 = $_POST[cname3];
}
else{
$errormsg = "Please enter company name, or type N/A";
}
if ($_POST[caddress3]){
$caddress3 = $_POST[caddress3];
}
else{
$errormsg = "Please enter company address, or type N/A";
}
if ($_POST[cphone3]){
$cphone3 = $_POST[cphone3];
}
else{
$errormsg = "Please enter company phone number, or type N/A";
}
if ($_POST[ccperson3]){
$ccperson3 = $_POST[ccperson3];
}
else{
$errormsg = "Please enter contact person's name, or type N/A";
}
if ($_POST[ctype3]){
$ctype3 = $_POST[ctype3];
}
else{
$errormsg = "Please enter type of work, or type N/A";
}
if ($_POST[cwage3]){
$cwage3 = $_POST[cwage3];
}
else{
$errormsg = "Please enter wage earned, or type N/A";
}
if ($_POST[cstart3]){
$cstart3 = $_POST[cstart3];
}
else{
$errormsg = "Please enter date started, or type N/A";
}
if ($_POST[cend3]){
$cend3 = $_POST[cend3];
}
else{
$errormsg = "Please enter date ended, or type N/A";
}
if ($_POST[creason3]){
$creason3 = $_POST[creason3];
}
else{
$errormsg = "Please enter reason for leaving, or type N/A";
}
if ($_POST[maywe]){
$maywe = $_POST[maywe];
}
else{
$errormsg = "Type names of companies you do not want us to contact, or type, ok all";
}
if ($_POST[additional]){
$additional = $_POST[additional];
}
else{
$errormsg = "Type N/A if you do not have any additional information";
}
if ($_POST[electronicsignfn]){
$electronicsignfn = $_POST[electronicsignfn];
## Heading ## }
else{
$errormsg = "Please enter your full name";
}
if ($_POST[electronicsignssn]){
$electronicsignssn = $_POST[electronicsignssn];
}
else{
$errormsg = "Please enter your Social Security Number";
}
if ($_POST[emailaddress]){
$emailaddress = $_POST[emailaddress];
}
else{
$errormsg = "Please enter your email address";
}
else{
if ($errormsg){ //if there is already an error, add next error
$errormsg = $errormsg;
}else{
}
}
}
?>