why does the following not work. it only takes me to the index.php page and cuts off the "get" data
<div class="wrapper">
<form class="form-signin" method="post">
<h2 class="form-signin-heading">Customer Not Found</h2>
No customer was found matching <?=$_POST['phone'];?>.<br/>
You can create a new customer with this number, or search again<br/>
<button
class="btn btn-lg btn-primary btn-block"
id="createCust"
>
Create A New Customer
</button>
<button class="btn btn-lg btn-primary btn-block" type="submit" name="login">Search Again</button>
</form>
</div>
<script type="text/javascript">
document.getElementById("createCust").onclick = function () {
location.href = "index.php?proc=newCust&p=<?=$_SESSION['phone'];?>";
};
</script>
As @Teemu stated:
The default action for a button in a form is to submit the form. A pending server call will block changes to location.href. Define the button as type of button. –
I had the "type" as submit, changing it to type="button" solved this problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.