can anyone help me, I don't know how to make a button that can be used for the same 2 forms & add php action on one page. I've seen some of the other questions but that didn't solve my problem
<form name="form2" id="form2" method="post" action="">
<div class="form-group">
<label for="name">Your Name</label>
<input type="text" class="form-control" id="name" required placeholder="Enter Your Name" name="name">
</div>
<div class="form-group">
<label for="notlp">Your Phone Number</label>
<input type="tel" class="form-control" id="notlp" required placeholder="Enter Your Phone Number" name="notlp">
</div>
<input type="hidden" name="cust" value="Toko A">
<div class="form-group" style="text-align: center;">
</form>
<form id="loginForm" class="form-horizontal" role="form" action="<?php echo $linkloginonly; ?>" method="post">
<input type="hidden" name="dst" value="<?php echo $linkorig; ?>"/>
<input type="hidden" name="popup" value="true"/>
<input type="hidden" value="cust" class="form-control input-lg" id="inputLogin" name="username"
placeholder="Login" autofocus required>
<input type="hidden" value="cust" class="form-control input-lg" id="inputPassword" name="password"
placeholder="Password" required>
<div class="align-content-center" style="text-align-center" > </div>
<button disabled id="btn" type="submit" class="btn btn-primary btn-block btn-lg">OK</button>
</form>
this for php file https://docs.google.com/document/d/1BJvMovZHH_My2leeE2djWiOYLIOuObrQQN01paawqgE/edit?usp=sharing
script
<script type="text/javascript" src="js/md5.js"></script>
<script type="text/javascript">
<!--
function doLogin() {
<?php if(strlen($chapid) < 1) echo "return true;n"; ?>
document.sendin.username.value = document.login.username.value;
document.sendin.password.value = hexMD5('<?php echo $chapid; ?>' + document.login.password.value + '<?php echo $chapchallenge; ?>');
document.sendin.submit();
return false;
}
//-->
</script>
<script>
document.getElementById('btn').onclick = function() {
var x = document.forms["form2"]["name"].value;
var y = document.forms["form2"]["notlp"].value;
if (x == "") {
alert("Name must be filled out");
return false;
} else (y == "") {
alert("Phone Number must be filled out");
return false;
}
}
</script>
<script>
getElementById('btn') = function(){
document.getElementById("form2").submit('SubmitButton');
}
</script>