Insertion into database not working

Hi there,

I have a problem with AJAX and PHP, where I can’t seem to update records via a form to a database, as my hosting account upgraded their PHP from 7.0 to 7.2 and SQL from MariaDB 10 to 10.2.17

Would anyone be able to assist with this?


<?php if(!(AJAX == 'true')){ header('HTTP/1.0 404 Not Found'); echo "

Error 404 Not Found

"; echo "The page that you have requested could not be found."; exit(); } ?> .datepicker{z-index:1151 !important;}
×Close

<?php echo $ajax['2'] ?>

<?php // ------------- ERROR -----------------
	foreach ($notification_msg as &$notification) { ?>
    <div class="alert <?php echo $notification['type'] ?>"><button type="button" class="close" data-dismiss="alert">&times;</button><strong><?php echo $notification['h4'] ?> </strong> <?php echo $notification['msg'] ?></div>
<?php } // ------------- ERROR ----------------- ?>
                 
		
			<input type="hidden" name="session_id" value="<?php echo $ajax['0'] ?>">
		    <input type="hidden" name="create_appointment" value="true">
		    
			<div class="form-group">
			    <label class="col-sm-3 control-label">Find Customer *</label>
			    <div class="col-sm-9">
					<select name="customer" id="customer-single" style="width:100%" required> 
						<option value="">Select a customer</option>
						<?php  foreach(customer_array($ajax['0']) as $customer){ ?>
				     	<option value="<?php echo $customer['id'] ?>"><?php echo $customer['business_name'] ?> - <?php echo $customer['first_name'] ?> <?php echo $customer['last_name'] ?></option>
				     	<?php } ?>
				    </select>
				    If your customer is not listed you can add them <a href="http://1fruit.co.uk/agent/customer/new/" >here</a>.
				</div>
			</div>
			<hr>
			<div class="form-group">
			    <label class="col-sm-2 control-label">Category *</label>
			    <div class="col-sm-10">
					<select name="category" id="category-single" style="width:100%" required> 
						<option value="">Select a category</option>
						<?php  foreach(category_array($ajax['0']) as $category){ ?>
				     	<option value="<?php echo $category['id'] ?>"><?php echo $category['name'] ?></option>
				     	<?php } ?>
				    </select>
				</div>
			</div>
			<div class="form-group">
			    <label class="col-sm-2 control-label">Date *</label>
			    <div class="col-sm-4">
					<input class="form-control datepicker" type="text" name="date" required>
				</div>
				<div class="col-sm-1">
					<label class="control-label">Time *</label>
				</div>
				<div class="col-sm-2">
					<input class="form-control timepicker" type="text" name="start_time" required>
				</div>
				<div class="col-sm-1">
					<label class="control-label">To *</label>
				</div>
				<div class="col-sm-2">
					<input class="form-control timepicker" type="text" name="end_time" required>
				</div>
			</div>
			
			<div class="form-group">
			    <label class="col-sm-3 control-label">Booked By *</label>
			    <div class="col-sm-9">
					<select name="booked_by" id="agent-single"  style="width:100%" required> 
						<?php  foreach (agent_array($ajax['0']) as $agent){ ?>
				     	<option <?php if($agent['id'] == get_agent_from_session($ajax['0'], 'id')){echo 'selected';} ?> value="<?php echo $agent['id'] ?>"><?php echo $agent['first_name'] ?></option>
				     	<?php } ?>
				    </select>
				</div>
			</div>
			<div class="form-group">
			    <label class="col-sm-3 control-label">Booked for *</label>
			    <div class="col-sm-9">
					<select name="booked_for[]" id="agent-multi"  multiple="multiple" style="width:100%" required> 
						<?php foreach (agent_array($ajax['0']) as $agent){ ?>
				     	<option value="<?php echo $agent['id'] ?>"><?php echo $agent['first_name'] ?></option>
				     	<?php } ?>
				    </select>
				</div>
			</div>

			<div class="form-group">
			    <label class="col-sm-2 control-label">Notes</label>
			    <div class="col-sm-10">
					<textarea class="form-control" name="notes"> </textarea>
				</div>
			</div>

</div>
<div class="modal-footer">
	<a href="#"  class="btn btn-default" data-dismiss="modal">Close</a>
	<button type="submit" class="btn btn-success">Save</button>
</div>

Have you tried debugging it yet?

Does the backend receive the request?

Sponsor our Newsletter | Privacy Policy | Terms of Service