PHP不验证电子邮件或传递值

时间:2013-12-12 18:01:23

标签: php phpmailer

已经有一段时间了,因为我不得不问一个关于PHP的问题,但我很难过。我有一个我前段时间做过的表单,其中包含填充程序的电子邮件和其主管的电子邮件字段。它确实有效,但随后我们的服务器崩溃,我们去了一个备份副本,现在它不是,我无法弄清楚为什么。有人可以告诉我我错过了什么吗?字段设置如下

编辑以显示整个表格。

    <form action="verify2.php" method="post" name="incidentreport" onSubmit="return IsValidTime(document.incidentreport.time.value);">
        <fieldset>
            <legend>
                <span lang="en-us">Incident Report</span>
            </legend>
                        <div class="style6">
                        <div class="style6">
            <div class="style7">
            <br>
    <table style="width: 100%">
        <tr>
            <td style="width: 248px" class="style1"><font size="-1" face="Arial, Helvetica, sans-                                                       serif" align="left">
                <label class="formtext" for="name">Name(s):<span lang="en-us">(required)</span> <?php                           if(isset($problems['name'])) {?><font color="red">*</font><?php } ?></label><br>

                <input class="inputstyle" type="text" name="name" value="<?php if(isset($_POST['name'])){ print($_POST['name']); }?>" style=" width: 288px">                                    </font>
            </td>

            <td style="width: 148px"><font size="-1" face="Arial, Helvetica, sans-serif"                        align="left">

                <label class="formtext" for="title">Title:(required) <?php if(isset($problems['title'])) {?><font               color="red">*</font><?php } ?></label><br>

                <input class="style6" type="text" name="title" value="<?php if(isset($_POST['title'])){                                                      print($_POST['title']); }?>" style=" width: 132px"></font>
            </td>   
        </tr>
    </table>
    <table style="width: 100%">
        <tr>
            <td style="width: 175px" class="style1"><font size="-1" face="Arial, Helvetica, sans-                                                       serif" align="left">
                <label class="formtext" for="name">E-mail(s):<span lang="en-us">(required)</span> <?php                             if(isset($problems['email'])) {?><font color="red">*</font><?php } ?></label><br>

                <input class="inputstyle" type="text" name="email" value="<?php if(isset($_POST['email'])){ print($_POST['email']); }?>" style=" width: 199px">                                     </font>
            </td>

            <td style="width: 175px" class="style1"><font size="-1" face="Arial, Helvetica, sans-serif"                         align="left">

                <label class="formtext" for="title">Supervisor's email:(required) <?php if(isset($problems['supervisor'])) {?><font                 color="red">*</font><?php } ?></label><br>

                <input class="style6" type="text" name="supervisor" value="<?php if(isset($_POST['supervisor'])){                                                    print($_POST['supervisor']); }?>" style=" width: 199px"></font>
            </td>   
        </tr>
    </table>



    <table >
        <tr>
            <td style="width: 300px" class="style6"><font size="-1" face="Arial, Helvetica, sans-serif" >


                <label class="formtext" for="date" >Date of Occurrence:(required) <?php  if(isset($problems['date'])) {?><font                              color="red">*</font><?php } ?><br></label>
                <input type="text" id="date" name="date" size=20   value="<?php if(isset($_POST['date'])){                                      print($_POST['date']); }?> " style="width: 229px" >

            </font></td>
            <td style="width: 154px" class="style6"><font size="-1" face="Arial, Helvetica, sans-serif"                                           align="left">


                            <label class="formtext" for="time">Time of Occurrence: <?php if(isset($problems['time'])) {?><font color="red">*</font><?php } ?></label><br>

                                </font><span class="style8">
            <input type="text" id="time" name="time" value="<?php if(isset($_POST['time'])){                                        print($_POST['time']); }?> "> </span></td></tr>     

<tr>

            <td style="width: 300px" class="style6"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                            <label class="formtext" for="building">Building: (required)<?php if(isset($problems['building'])) {?><font                              color="red">*</font><?php } ?></label><br>

                                <input class="inputstyle" type="text" name="building" value="<?php if(isset($_POST['building'])){                                       print($_POST['building']); }?>" style=" width: 251px"></font></td>

            <td style="width:154px" class="style6"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                            <label class="formtext" for="room">Room: <?php if(isset($problems['room'])) {?><font color="red">
                            *</font><?php } ?></label><br>

                                <input class="inputstyle" type="text" name="room" value="<?php if(isset($_POST['room'])){                                               print($_POST['room']);}?>" style=" width: 60px"></font></td>

        </tr>
    </table>

    <script type="text/javascript">
  AnyTime.picker( "date",
    { format: "%W, %M %d, %Y", firstDOW: 0} );
  $("#time").AnyTime_picker(
    { format: "%h:%i %p", labelTitle: "Time",
      labelHour: "Hour", labelMinute: "Minute" } );
</script>
    <table style="width: 100%; height: 72px;">
        <tr>
            <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                            <label class="formtext" for="location">Location Description:(required) <?php if(isset($problems['location'])) {?>                           <font color="red">*</font><?php } ?></label><br>

                                <textarea  class="inputstyle" name="location"  style=" width: 383px; height: 115px;" ><?php                                             if(isset($_POST['location'])){ print($_POST['location']); }?></textarea></font><br></td>
                                        </tr>
    </table>
                                <br>

            <p class="style5">Person (s) involved in incident</p><p class="style1">Must list at least 1 Name/Title/Phone or fill in N/A.</p>
    <table >
        <tr>
            <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">



                            <label class="formtext" for="person">Name:<?php if(isset($problems['person'])) {?><font color="red">*</font><?php }                             ?></label><br>
                                <input class="inputstyle" type="text" name="person" value="<?php if(isset($_POST['person'])){                                             print($_POST['person']); }?>" style="width: 249px"></font>
            </td>
            <td style="width: 114px">

                            <label class="formtext" for="title1">Title:<?php if(isset($problems['title1'])) {?><font color="red">*</font><?php }                            ?></label><br>
                                            <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
                                <input class="inputstyle" type="text" name="title1" value="<?php if(isset($_POST['title1'])){                                            print($_POST['title1']); }?>" style=" width: 100px"></font>
            </td>
            <td style="width: 104px">

                            <label class="formtext" for="phone1"><span lang="en-us">Phone</span>:<?php if(isset($problems['phone1'])) {?><font color="red">*</font><?php }                          ?></label><br>
                                <input class="inputstyle" type="text" name="phone1" value="<?php if(isset($_POST['phone1'])){                                             print($_POST['phone1']); }?>" style="width: 75px">
            </td>
        </tr>
        <tr>
            <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                <input type="text" name="person2" value="<?php if(isset($_POST['person2'])){ print($_POST['person2']); }?>"                                 style="width: 249px" style="width: 249px"></font>
            </td>
            <td style="width: 114px">
                                <input class="inputstyle" type="text" name="title2" value="<?php if(isset($_POST['title2'])){                                   print($_POST['title2']); }?>" style="width: 100px"></td>

            <td style="width: 104px">
                                <input class="inputstyle" type="text" name="phone2" value="<?php if(isset($_POST['phone3'])){                                   print($_POST['phone3']); }?>" style="width: 75px">
            </td>
        </tr>

        <tr>
            <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                <input class="inputstyle" type="text" name="person3" value="<?php if(isset($_POST['person3'])){                                  print($_POST['person3']); }?>" style="width: 252px"></font>
            </td>
            <td style="width: 114px; height: 26px;">

                                <input class="inputstyle" type="text" name="title3" value="<?php if(isset($_POST['title3'])){                                print($_POST['title3']); }?>" style=" width: 100px">
            </td>

            <td style="width: 104px">
                                <input class="inputstyle" type="text" name="phone3" value="<?php if(isset($_POST['phone3'])){                                    print($_POST['phone3']); }?>" style=" width: 75px">
            </td>
        </tr>


        <tr>
            <td style="width: 224px">
                                <input class="inputstyle" type="text" name="person4" value="<?php if(isset($_POST['person4'])){                                       print($_POST['person4']); }?>" style=" width: 252px">
            </td>
            <td style="width: 114px; height: 26px;">

                                <input class="inputstyle" type="text" name="title4" value="<?php if(isset($_POST['title4'])){                                    print($_POST['title4']); }?>" style=" width: 100px">
            </td>
            <td style="width: 104px">
                                <input class="inputstyle" type="text" name="phone4" value="<?php if(isset($_POST['phone4'])){                               print($_POST['phone4']); }?>" style=" width: 75px">
            </td>
        </tr>
    </table></div></div></div></fieldset>
        <fieldset>
            <legend>
                Please Select at least one:
            </legend>
        <p class="style5">Type of Alleged Occurrence:<input name="occurrence" type="hidden" value="<?php { print 'Type of Occurrence'; }?>"></p>
                                <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
    <table style="width: 100%" class="style6">
        <tr>
            <td style="width: 20%; height: 57px;" ><strong> Disruption:</strong><br>

                    <input name="obscene" type="checkbox" value="Obscene Language" <?php if(isset($_POST['obscene'])) echo                                     "checked"; ?>>
                        <label >Obscene language </label>
            </td>
            <td style="width: 23%; height: 57px;">
                            <strong> Sexual Harassment:</strong><br>

                    <input name="sexharass[]" type="checkbox" value="Physical" <?php if(isset($_POST['sexharass']) && in_array('Physical',$_POST['sexharass'])) { echo 'checked'; } ?>>                         
                        <label>Physical </label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                    <input name="sexharass[]" type="checkbox" value="Verbal" <?php if(isset($_POST['sexharass']) && in_array('Verbal',$_POST['sexharass'])) { echo 'checked'; } ?>>                     
                        <label>Verbal </label>
            </td>
        </tr>
        <tr>
            <td style="width: 20%; height: 57px;">
                            <strong> Altercation:</strong><br>
                    <input name="altercation1[]" type="checkbox" value="Verbal" <?php if(isset($_POST['altercation1']) && in_array('Verbal',$_POST['altercation1'])) { echo 'checked'; } ?>>
                            <label>Verbal</label>
                                <input name="altercation1[]" type="checkbox" value="Physical"<?php if(isset($_POST['altercation1']) && in_array('Physical',$_POST['altercation1'])) { echo 'checked'; } ?> >
                            <label >Physical</label><br><br>

            <td style="width: 23%; height: 57px;"><strong>Involved in altercation:</strong><br>


                                <input name="altercation2[]" type="checkbox" value="student/student" <?php if(isset($_POST['altercation2']) && in_array('student/student',$_POST['altercation2'])) { echo 'checked'; } ?>>

                            <label>Student/Student <br> </label>

                                <input name="altercation2[]" type="checkbox" value="student/faculty-staff" <?php if(isset($_POST['altercation2']) && in_array('student/faculty-staff',$_POST['altercation2'])) { echo 'checked'; } ?>>
                            <label >Student/Faculty/Staff </label>
            </td>
        </tr>
        <tr>
            <td style="width: 20%">
                            <strong> Theft/ Damage to Property:</strong><br>
                                <input name="property[]" type="checkbox" value="DACC" <?php if(isset($_POST['property']) && in_array('DACC',$_POST['property'])) { echo 'checked'; } ?> >                           <label >DACC </label>&nbsp;<span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size="-1"                                     face="Arial, Helvetica, sans-serif" align="left">

                                <input name="property[]" type="checkbox" value="Self" <?php if(isset($_POST['property']) && in_array('Self',$_POST['property'])) { echo 'checked'; } ?> >                           <label  >Self </label>



                        </font>&nbsp;&nbsp;<br>
                                        </span>

                                <input name="property[]" type="checkbox" value="Faculty/Staff" <?php if(isset($_POST['property']) && in_array('Faculty/Staff',$_POST['property'])) { echo 'checked'; } ?> >
                            <label >Faculty/Staff </label><br>
<br>


            </td>
            <td style="width: 23%">
                            <strong> Threat of Harm to Self or Others:</strong><br>

                                <input name="harm[]"  type="checkbox" value="Student/Student" <?php if(isset($_POST['harm']) && in_array('Student/Student',$_POST['harm'])) { echo 'checked'; } ?>  >
                            <label  >Student/Student </label>&nbsp;<span lang="en-us">&nbsp;&nbsp;&nbsp;
                                <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
                                <input name="harm[]"  type="checkbox" value="Self" <?php if(isset($_POST['harm']) && in_array('Self',$_POST['harm'])) { echo 'checked'; } ?>>
                            <label  >Self </label>

                                <br>
                                <input name="harm[]"  type="checkbox" value="Student/Faculty-Staff" <?php if(isset($_POST['harm']) && in_array('Student/Faculty-Staff',$_POST['harm'])) { echo 'checked'; } ?>>                         
                            <label>Student/Faculty-Staff </label><br>



                &nbsp;&nbsp;
            </font></span></td>
        </tr>


        <tr>
            <td style="width: 20%">
                                <strong> Drugs/Alcohol:</strong><br>
                                <input name="drugs[]" type="checkbox" value="Under the Influence" <?php if(isset($_POST['drugs']) && in_array('Under the Influence',$_POST['drugs'])) { echo 'checked'; } ?> >
                            <label >Under the Influence<br> </label>
                                <font size="-1" face="Arial, Helvetica, sans-serif" align="left">
                                <input name="drugs[]" type="checkbox" value="Possession" <?php if(isset($_POST['drugs']) && in_array('Possession',$_POST['drugs'])) { echo 'checked'; } ?> >                            <label  >Possession </label>



                                </font>



            </td>
            <td style="width: 23%">
                                <strong> Other Occurrences:</strong><br>
                                <input name="other[]" type="checkbox" value="Tresspassing" <?php if(isset($_POST['other']) && in_array('Tresspassing',$_POST['other'])) { echo 'checked'; } ?>  >                           <label  >Trespassing </label>&nbsp;<span lang="en-us">&nbsp;&nbsp;&nbsp;<font size="-1" face="Arial,                            Helvetica, sans-serif" align="left">
                                <input name="other[]" type="checkbox" value="Other" <?php if(isset($_POST['other']) && in_array('Other',$_POST['other'])) { echo 'checked'; } ?> >
                            <label  >Other </label>



                                </font><br>
                                        </span>
            </td>
        </tr>   
    </table><p></p>                     
                                </font>
    <table style="width: 100%; height: 72px;">
        <tr>
            <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">
                            <label class="formtext" for="explanation">Detailed Explanation:(required) <?php if(isset($problems['explanation']))                                 {?> <font color="red">              *</font><?php } ?></label><br>

                            <textarea name="explanation"  style=" width: 450px; height: 220px;" ><?php if(isset($_POST['explanation'])){                                    print($_POST['explanation']); }?></textarea></font><br></td>
        </tr>
    </table>




                                </fieldset><br>
                                <fieldset>
            <legend>
                Actions Taken:
            </legend>
<div class="style6">
            <br>
                        <label class="formtext" for="security"><?php if(isset($problems['security'])) {?><font color="red">
                        *</font><?php } ?>Was Security Notified:(required)</label>
                            <select name="security" class="dropdownstyle">
                                <option value="">--Choose one--</option>
                                <option value="Yes" <?php if (isset($_POST['security'])&&($_POST['security']=="Yes")) { ?>
                                    selected="selected" <?php }?> >Yes</option>
                                <option value="No" <?php if (isset($_POST['security'])&&($_POST['security']=="No")) { ?>
                                    selected="selected" <?php }?> >No</option></select><br><br>

                                <label class="formtext" for="police"><?php if(isset($problems['police'])) {?><font color="red">
                                    *</font><?php } ?>Were Police Notified:(required)</label>
                            <select name="police" class="dropdownstyle">
                                <option value="">--Choose one--</option>
                                <option value="Yes" <?php if (isset($_POST['police'])&&($_POST['police']=="Yes")) { ?>
                                    selected="selected" <?php }?> >Yes</option>
                                <option value="No" <?php if (isset($_POST['police'])&&($_POST['police']=="No")) { ?>
                                    selected="selected" <?php }?> >No</option></select><br><br>


                                <label class="formtext" for="witness"><?php if(isset($problems['witness'])) {?><font color="red">
                                    *</font><?php } ?>Were there Witnesses?(required)<br> (if yes, list names of 
                                    witnesses):<span lang="en-us">
                        </span></label>

                            <select id="witness" name="witness" class="dropdownstyle">
                                <option value="">--Choose one--</option>
                                <option value="Yes" <?php if (isset($_POST['witness'])&&($_POST['witness']=="Yes")) { ?>
                                    selected="selected" <?php }?> >Yes</option>
                                <option value="No" <?php if (isset($_POST['witness'])&&($_POST['witness']=="No")) { ?>
                                    selected="selected" <?php }?>>No</option></select><br>



            <p class="style5">Witnesses to the Incident:</p>
    <table >
        <tr>
            <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                    <span lang="en-us">

                                <label class="formtext" for="wperson">Name:</label></span><br>
                                    <input class="inputstyle" type="text" name="wperson" value="<?php if(isset($_POST['wperson'])){                                             print($_POST['wperson']); }?>" style="width: 249px"></font></td>
            <td style="width: 114px"><label class="formtext" for="wtitle1">
                                            <span lang="en-us">Title</span>:</label><br>
                                            <font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                    <input class="inputstyle" type="text" name="wtitle1" value="<?php if(isset($_POST['wtitle1'])){                                             print($_POST['wtitle1']); }?>" style=" width: 100px"></font>
            </td>
            <td style="width: 104px"><label class="formtext" for="wphone1">
                                            <span lang="en-us">Phone</span>:</label><br>
                                    <input class="inputstyle" type="text" name="wphone1" value="<?php if(isset($_POST['wphone1'])){                                             print($_POST['wphone1']); }?>" style="width: 75px">
            </td>
        </tr>
        <tr>



            <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                    <input type="text" name="wperson2" value="<?php if(isset($_POST['wperson2'])){ print($_POST['wperson2']);                                   }?>" style="width: 249px; width : 249px"></font></td>

            <td style="width: 114px">

                                    <input class="inputstyle" type="text" name="wtitle2" value="<?php if(isset($_POST['wtitle2'])){                                         print($_POST['wtitle2']); }?>" style="width: 100px"></td>

            <td style="width: 104px">

                                    <input class="inputstyle" type="text" name="wphone2" value="<?php if(isset($_POST['wphone3'])){                                         print($_POST['wphone3']); }?>" style="width: 75px"></td></tr>

        <tr>
            <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                    <input class="inputstyle" type="text" name="wperson3" value="<?php if(isset($_POST['wperson3'])){                                       print($_POST['wperson3']); }?>" style="width: 252px"></font></td>
            <td style="width: 114px; height: 26px;">

                                    <input class="inputstyle" type="text" name="wtitle3" value="<?php if(isset($_POST['wtitle3'])){                                         print($_POST['wtitle3']); }?>" style=" width: 100px"></td>
            <td style="width: 104px">

                                    <input class="inputstyle" type="text" name="wphone3" value="<?php if(isset($_POST['wphone3'])){                                         print($_POST['wphone3']); }?>" style=" width: 75px"></td></tr>


    </table>
    </div>

                                <br><br>
    <table style="width: 100%; height: 72px;">
        <tr>
            <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">

                                <label class="formtext" for="acttaken">Immediate Action Taken: (required) <?php                                               if(isset($problems['acttaken'])) {?><font color="red">*</font><?php } ?></label><br>

                                    <textarea name="acttaken"  style=" width: 450px; height: 220px;" ><?php if(isset($_POST['acttaken'])){                                      print($_POST['acttaken']); }?></textarea></font><br>
            </td>
        </tr>
    </table>

                                <br><br>
    <table style="width: 100%; height: 72px;">
        <tr>
            <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left">
                                <label class="formtext" for="followact">Follow-up Action Taken: (required)<?php                                                         if(isset($problems['followact'])) {?><font color="red">*</font><?php } ?></label><br>

                                    <textarea name="followact"  style=" width: 450px; height: 220px;" ><?php if(isset($_POST['followact'])){                                        print($_POST['followact']); }?></textarea></font><br></td>
        </tr>
    </table>
</fieldset>
                    <br><br>



<?php require_once('recaptchalib.php');
  $publickey = "6LfeDeUSAAAAAOCEaree8A3_IavtN_1uADaKLSrB"; // you got this from the signup page
  echo recaptcha_get_html($publickey);?>


        <input type="submit" name="submit" value="Submit" class="buttonsubmit">
    </form>

1 个答案:

答案 0 :(得分:0)

问题在于电子邮件验证编码。我删除了电子邮件验证后就可以了。现在来修复验证!