注意:未定义的偏移量:第42行的C:\ xampp \ htdocs \ Thesis \ create.php中的1

时间:2017-10-04 10:04:00

标签: php html5

即时制作日历活动 并弹出此错误 注意:未定义的偏移量:第42行的C:\ xampp \ htdocs \ Thesis \ create.php中的1

注意:未定义的偏移量:第43行的C:\ xampp \ htdocs \ Thesis \ create.php中的2

create.php

    if (isset($_POST['create_event'])) {
    // receive all input values from the form
    $firstname = mysql_real_escape_string($_POST['firstname']);
    $lastname = mysql_real_escape_string($_POST['lastname']);
    $address = mysql_real_escape_string($_POST['location']);
    $phone = mysql_real_escape_string($_POST['phone']);
    $email = mysql_real_escape_string($_POST['email']);
    $event_title = mysql_real_escape_string($_POST['event_title']);
    $event_type = mysql_real_escape_string($_POST['event_type']);
    $location = mysql_real_escape_string($_POST['location']);
    $firsttime = mysql_real_escape_string($_POST['firsttime']);
    $lasttime = mysql_real_escape_string($_POST['lasttime']);
    $date = mysql_real_escape_string($_POST['date']);
    $event_info = mysql_real_escape_string($_POST['event_info']);

    if(empty($firstname) ||empty($lastname) ||empty($address) ||empty($email) || empty($event_title) || empty($event_type) || empty($location) ||empty($firsttime)||empty($lasttime) || empty($date)|| empty($event_info))
    {
        array_push($errors, "All fields are required");
    }
    else
    {

        $firsttime = str_replace(':','',$firsttime);
        $lasttime = str_replace(':','',$lasttime);
        if($firsttime >= $lasttime)
        {
            array_push($errors, "From time cannot be greater than to time");
        }
        else
        {
            $break_date = explode('/',$date);
            $month = $break_date[0];
            $day = $break_date[0];
            $year = $break_date[0];
            $sql = mysql_query("INSERT INTO `event` (firstname,lastname,address,phone,email,event_title,event_type,location,day,month,year,firsttime,lasttime,event_info,datetime) VALUES ('$firstname','$lastname','$address','$phone','$email','$event_title','$event_type','$location','$day','$month','$year','$firsttime','$lastname','$event_info',NOW())");

            $affect = mysql_affected_rows();
            if($affect >= 1)
            {
                $success = 'Event edited successfully';
            }
        }
    }
}

create_event.php         

    <?php include('errors.php'); ?>

    <div class="input-group">
    <label><strong>Personal Information</strong></label>
    </div>
    <div class="input-group">
    <label>FIRST NAME:</label>
    <input type="text" name="firstname">
    </div>
    <div class="input-group">
    <label>LAST NAME:</label>
    <input type="text" name="lastname">
    </div>
    <div class="input-group">
    <label>Address</label>
    <textarea rows="4" cols="50" name="address"></textarea>
    </div>
    <div class="input-group">
    <label>Phone Number:</label>
    <input type="text" name="phone" value="" onkeypress="return isNumberKey(event)" maxlength="11"/>
    </div>
    <div class="input-group">
        <?php  if (isset($_SESSION['email'])) :?>
        <input type="hidden" name="email" value="<?php  if (isset($_SESSION['email'])) {echo $_SESSION['email'];} ?>">
        <?php endif ?>  
     </div>

    <div class="input-group">
        <label><strong>Event Details</strong></label>
    </div>

    <div class="input-group">
        <label>Event Title</label>
        <input type="text" name="event_title" >
    </div>
    <div class="input-group">
    <label>Event Type</label>
        <select name="event_type">
            <option value=""></option>
            <option value="Small Concert">Small Concert</option>
            <option value="Medium Concert">Medium Concert</option>
            <option value="Large Concert">Large Concert</option>
            <option value="Wedding">Wedding</option>
            <option value="Debut">Debut</option>
            <option value="Birthday">Birthday</option>
            <option value="Anniversary">Anniversary</option>
            <option value="Graduation">Graduation</option>
            <option value="Live Band">Live Band</option>
            <option value="Pageant">Pageant</option>
            <option value="Schools Affair">School Affair</option>
            <option value="Community Event">Community Event</option>
            <option value="SM Event">SM Event</option>
            <option value="Fashion Show">Fashion Show</option>
            <option value="Dance Party Service">Dance Party Service</option>
        </select>
    </div>


    <div class="input-group">
    <label>Pick Location</label>
        <select name="location">
            <option value=""></option>
            <option value="Alabang City">Alabang</option>
            <option value="South City">South City</option>
            <option value="Batangas City">Batangas City</option>
            <option value="Cavite City">Cavite City</option>
            <option value="Laguna City">Laguna City</option>
        </select>
    </div>
    <div class="date">
    <label>Pick Date</label>
   <input type="date" name="date">
    </div>
    <div class="date">
    <label>Start Time</label>
    <input type="time" name="firsttime">
    </div>
    <div class="date">
    <label>Due Time</label>
    <input type="time" name="lasttime">
    </div>

    <div class="event_info">
        <label>Event Information</label>
        <textarea rows="4" cols="50" name="event_info"></textarea>
    </div>

    <div class="input-group">
        <button type="submit" class="btn" name="create_event">Proceed to Payment</button>
    </div>
</form>

............................................... .................................................. .................................................. .......

0 个答案:

没有答案