<?php
session_start();
$host = "localhost";
$username = "root";
$password = "";
$db = "linkway";
$con = mysqli_connect($host , $username , $password , $db);
switch (isset($_POST['type'])) {
case 'UpdateMembers':
extract($_POST);
$id = $_SESSION["insert_id"];
$UtimePage2 = date("Y-m-d H:i:s");
$query = "UPDATE `NewMembers` SET `UtimePage2`='$UtimePage2',`InfoEmailAddress`='$email',`InfoMobileNumber`='$contact_no',`IpCountry`='$country',`IpCity`='$city',`PosisionAplaingFor`='$AplayingPosition' where ID = '$id' ";
$result = mysqli_query($con , $query);
if($result){
$_SESSION["message"] = "Members Add Successfully";
}else{
$response = json_encode(array('status' => 500 , 'message' => 'Internal Server'));
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#apDiv1 {
position: absolute;
width: 434px;
height: 304px;
z-index: 1;
left: 30px;
top: 7px;
background-color: #00CCFF;
}
</style>
</head>
<body>
<div id="apDiv1">
<div class="message">
<?php if (isset( $_SESSION["message"])){echo $_SESSION['message']; unset ($_SESSION["message"]);;}?>
</div>
<form id="form1" name="form1" method="post" action="file:///C|/Users/Admin/Downloads/JobA2.php">
<table width="399" height="290" border="1" align="center">
<tr>
<td width="151" align="right">Email Address:</td>
<td width="205"><label for="Email"></label>
<input type="text" name = "email" autocomplete="off" id="Email" size="30" maxlength="30" /></td>
<td width="21" rowspan="5"> </td>
</tr>
<tr>
<td align="right">Country:</td>
<td><label for="Country"></label>
<input type="text" name = "country" id="Country" autocomplete="off" size="20" maxlength="20" /></td>
</tr>
<tr>
<td align="right">City:</td>
<td><label for="City"></label>
<input type="text" name = "city" id="City" autocomplete="off" size="25" maxlength="25" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap">Mobile phone Number:</td>
<td><label for="textfield"></label>
<input type="text" name = "contact_no" id="contact_no" autocomplete="off" size="11" maxlength="12" /></td>
</tr>
<tr>
<td align="right">Position Aplaying for:</td>
<td><label for="AplayingPosition"></label>
<input onkeyup="check_fill()" type="text" autocomplete="off" name = "AplayingPosition" id="AplayingPosition" size="30" maxlength="30" /></td>
</tr>
<input type="hidden" name="type" value="UpdateMembers">
<tr>
<td colspan="3" align="center"><input type="submit" disabled name="Submit" id="Submit" value=" Continue " /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
<script>
/** FOR VALIDATION */
const submitBtn = document.getElementById('Submit')
const Email = document.getElementById('Email');
const Country = document.getElementById('Country');
const City = document.getElementById('City');
const contact_no = document.getElementById('contact_no');
const applying_for = document.getElementById('AplayingPosition');
// const cBox = document.getElementById('c-box')
// run this function whenever the values of any of the above 4 inputs change.
// this is to check if the input for all 4 is valid. if so, enable submitBtn.
// otherwise, disable it.
const checkEnableButton = () => {
submitBtn.disabled = !(
Email.value &&
Country.value &&
City.value &&
contact_no.value &&
applying_for.value
)
}
Email.addEventListener('change', checkEnableButton)
Country.addEventListener('change', checkEnableButton)
City.addEventListener('change', checkEnableButton)
contact_no.addEventListener('change', checkEnableButton)
applying_for.addEventListener('change' ,checkEnableButton)
function check_fill(){
checkEnableButton();
}
</script>