0

我试图弄清楚为什么它与 $bookingDate 相呼应。我的代码中没有任何回显或打印语句,因此很难理解为什么它会在响应控制台中回显。我希望有人来看看是什么导致了这个问题。

    function submitBooking()
    {
        $outputArray = array('error' => 'yes', 'message' => 'unproccessed');
        $outputMsg = '';
        // Sets validation rules for the login form
        $this->form_validation->set_rules('eventName', 'Event Name',
            'is_natural_no_zero');
        $this->form_validation->set_rules('label', 'Label',
            'is_natural_no_zero');
        $this->form_validation->set_rules('bookingDate', 'Booking Date',
            'required');
        $this->form_validation->set_rules('location', 'Location',
            'required');
        $this->form_validation->set_rules('arena', 'Arena',
            'is_natural_no_zero');  
        $this->form_validation->set_rules('introduction', 'Introduction',
            'required');

        // Checks to see if login form was submitted properly
        if (!$this->form_validation->run())
        {
            $outputArray['message'] =
                'There was a problem submitting the form! Please refresh the window and try again!';
        }
        else
        {
            $bookingDate = $this->input->post('bookingDate');
            $bookingDate = date("d-m-Y h:i:s", strtotime($bookingDate));


            if ($this->eventsmodel->bookEvent($this->input->post('eventName'), $this->input->post('label'), $bookingDate, $this->input->post('location'), $this->input->post('arena'), $this->input->post('introduction')))
            {
                $outputArray = array('success' => 'Yes', 'message' =>
                                            'The event was booked successfully!');
            }
            else
            {
                $outputArray['message'] =
                'The event was not booked! Please try again later!';
            }
        }
        echo json_encode($outputArray);
    }
4

1 回答 1

1

在中查找echo 语句eventsmodel->bookEvent你可能会在$bookingDate那儿呼应。这里一切都很好。

希望这可以帮助。

于 2012-04-25T18:23:23.420 回答