I'm grossly underqualified to be trying what I'm trying but I seem to have things going my way until now. I have an issue with my function which seems like it isn't being called when the form submit button is clicked. Apologies if this is formatted poorly. Please see my code below, Thanks
Functions.php
// UP DATE INFO
function settingsUpdate()
{
// call these variables with the global keyword to make them available in function
global $db;
// receive all input values from the form. Call the e() function
// defined below to escape form values
$usernameU = e($_POST['name']);
$numberU = e($_POST['number']);
$id = (isset($_SESSION['user']['id']));
$error = '0';
if($error == 0){
$query = "UPDATE users SET 'username' 'number' WHERE id==$id
VALUES('$usernameU', '$numberU')";
mysqli_query($db, $query);
echo '<div class="alert alert-primary" role="alert">User Settings Updated Successfully.</div>';
} else {
?><div class="alert alert-danger" role="alert">
<p class="text-center"><strong>Oh snap!</strong> Something went wrong, contact us if you think that's wrong.</p>
</div>,<?php
}
}
Settings.php
<!--begin::Form-->
<form id="settings" class="form" method="post">
<!--begin::Card body-->
<div class="card-body border-top p-9">
<!--begin::Input group-->
<div class="row mb-6">
<!--begin::Label-->
<label class="col-lg-4 col-form-label required fw-bold fs-6">Full Name</label>
<!--end::Label-->
<!--begin::Col-->
<div class="col-lg-8">
<!--begin::Row-->
<div class="row">
<!--begin::Col-->
<div class="col-lg-6 fv-row">
<input type="text" name="username" class="form-control form-control-lg form-control-solid mb-3 mb-lg-0" placeholder="Full Name" value="<?php echo $username; ?>" />
</div>
<!--end::Col-->
</div>
<!--end::Row-->
</div>
<!--end::Col-->
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="row mb-6">
<!--begin::Label-->
<label class="col-lg-4 col-form-label fw-bold fs-6">
<span class="required">Contact Number</span>
<i class="fas fa-exclamation-circle ms-1 fs-7" data-bs-toggle="tooltip" title="Phone number must be active"></i>
</label>
<!--end::Label-->
<!--begin::Col-->
<div class="col-lg-8 fv-row">
<input type="number" name="number" class="form-control form-control-lg form-control-solid" placeholder="Phone number" value="<?php echo $_SESSION['user']['number']?>" />
</div>
<!--end::Col-->
</div>
<!--end::Input group-->
</div>
<!--end::Card body-->
<!--begin::Actions-->
<div class="card-footer d-flex justify-content-end py-6 px-9">
<button type="submit" class="btn btn-primary" id="settingsUpdate">Save Changes</button>
</div>
<!--end::Actions-->
</form>
<!--end::Form-->