0

It's been a while since I had to ask a question about PHP but I am stumped. I have a form that I had done some time ago that had a field for the filler's email and for the email for their supervisor. it did work but then our server crashed and we went to a back up copy and now it's not, and I can't figure out why. Can someone please tell me what I am missing? the fields are set up as follows

Edited to show whole form.

    <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>
Inky1231
  • 85
  • 4
  • 16
  • 1
    What do you see when you do var_dump($_POST['email']), my guess it that it's empty – Michael Villeneuve Dec 12 '13 at 18:09
  • You might find an answer @ http://stackoverflow.com/questions/1282909/php-post-array-empty-upon-form-submission. Most likely you have some sort of redirect happening, e.g. submit-here.php gets bounced to www.submit-here.php by your server. – Dave Dec 12 '13 at 19:29
  • @Inky1231 Give us the whole form. The problem is there. Please clean up the code when you post. By respect for those who are trying to solve the issue, indent, comment as best as you can. – Michael Villeneuve Dec 12 '13 at 19:30
  • @MichaelVilleneuve I am trying... it is in nice formatting in my editor but when I paste it here it is all messed up. – Inky1231 Dec 12 '13 at 19:44
  • @Dave I am not sure that is what is happening but I will check. – Inky1231 Dec 12 '13 at 19:45
  • @MichaelVilleneuve I tried pasting the whole form but it told me too many characters. The rest of the form is passing fine and emails normally but the email is not. – Inky1231 Dec 12 '13 at 19:52
  • @Inky1231 you can remove most of the PHP it's useless. The only PHP I need is : var_dump($_POST); The form is much more important as this is most likely where the problem is. – Michael Villeneuve Dec 12 '13 at 19:57
  • @MichaelVilleneuve added the whole form. – Inky1231 Dec 12 '13 at 20:05
  • @Inky1231 I also need var_dump($_POST); of verify2.php. If it's too big go host it on imgurl with a screenshot. – Michael Villeneuve Dec 12 '13 at 20:08
  • @MichaelVilleneuve here is the vardump... it is seeing it... but I am still getting invalid email and the require is showing as not there `array(41) { ["name"]=> string(1) "t" ["title"]=> string(1) "t" ["email"]=> string(20) "aabdelzaher@dacc.edu" ["supervisor"]=> string(20) "ampeck@earthlink.net" ["date"]=> string(27) "Thursday, December 12, 2013" ["time"]=> string(8) "01:59 PM" ["building"]=> ` – Inky1231 Dec 12 '13 at 20:10
  • @MichaelVilleneuve I truncated it but all the variables are there. – Inky1231 Dec 12 '13 at 20:12
  • here is the screenshot http://imgur.com/3Au8ffU – Inky1231 Dec 12 '13 at 20:14

1 Answers1

0

The problem is with the email verification coding. Once I removed the email verification it worked. Now to fix the verification!

Inky1231
  • 85
  • 4
  • 16