I’m trying to figure out why its echoing the $bookingDate. I don’t have any echo or print statements going on in my code so its hard to understand why its echoing in the response console. I’m hoping there will be someone to see what’s causing this issue.
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);
}
Look in for an echo statement in
eventsmodel->bookEvent. You might be echoing the$bookingDatethere. here is everything fine.Hope this helps.