I'm trying to redirect my modal form to my php script, I've used action but for some reason the button just clicks and stops.
<form action="action.php" method="post" role="form" target="action.php">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input class="form-control" id="exampleInputEmail1" placeholder="Enter email" type="email" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input class="form-control" id="exampleInputPassword1" placeholder="Password" type="password" />
</div>
<!-- Form submit button -->
<button class="btn btn-primary" data-target="action.php" data-toggle="button" type="submit">Submit</button>
</form>
</div> <!-- opened somewhere else -->
</div> <!-- opened somewhere else -->
<p>
<!-- Opens the modal -->
<button class="btn btn-light" data-target="#surveymodal" data-toggle="modal" type="button">Submit</button>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</p>
</body>
</html>
Your submit button's type seems to be incorrect:
<p><button class="btn btn-light" data-target="#surveymodal" data-toggle="modal" type="submit">Submit</button><script src="assets/js/jquery.min.js"></script><script src="assets/js/popper.js"></script><script src="bootstrap/js/bootstrap.min.js"></script></p>
Fix above.
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.