How to do a redirect after sending the form to a modal window?

Hello! Ransacked all sources of information and do not understand... How after you submit the form to call a modal window?

Form:
spoiler


<form class="forma" action="order.php" method="post">
 <div class="form-row">
 <div class="form-group col-md-6">
 <input type="text" name="name" class="form-control" id="name" placeholder="Name">
</div>
 <div class="form-group col-md-6">
 <input type="text" name="fio" class="form-control" id="fio" placeholder="last Name">
</div>
</div>
 <div class="form-row">
 <div class="form-group col-md-6">
 <input type="tel" name="phone" class="form-control" id="phone" placeholder="phone Number">
</div>
 <div class="form-group col-md-6">
 <input type="email" name="email" class="form-control" id="email" placeholder="Email">
</div>
</div>
 <div class="form-group">
 <textarea type="text" name="text" class="form-control" placeholder="Comments/questions"></textarea>
</div>

 <button type="submit" class="btn btn-primary" >send</button>
</form>




Php:

spoiler

$to = "Burley@mail.ru"; // email of recipient data from the form 
$tema = "contact Form PHP"; // the subject of the received email

$message .= "Name: ".$_POST['name']."<br>";
$message .= "Last name: ".$_POST['fio']."<br>";
$message .= "Phone: ".$_POST['phone']."<br>";
$message .= "Email: ".$_POST['email']."<br>";
$message .= "Comment: ".$_POST['text']."<br>"; 

$headers = 'MIME-Version: 1.0' . "\r\n"; // header conforms to the format plus the newline character
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // indicates the type of the sent content
mail($to, $tema, $message, $headers); //sends the recipient an email the values of the variables



header("Location: index.html#myModal");
 exit;




Modal window:

spoiler


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog" role="document">
 <div class="modal-content">

 <div class="modal-body">
<p>Thanks!</p>
</div>
 <div class="modal-footer">
 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
 </div> 
</div>


April 19th 20 at 12:43
1 answer
April 19th 20 at 12:45
A modal window is not part of the basic layout of the page is something that is controlled by additional parameters, figuratively.
Url like index.html#myModal is a link with prakruthi to the anchor page, it scroll to the link, and not to element with id myModal. Modelku it is possible to show using javascript.
Usually there are two approaches - submit form with ajax, after successful treatment of the screening of modelki, and sending the form in the usual way and redirect to another page with text that the form was successfully sent. If you want to show modelco as now, a page must traverse the cookie or get-parameter with reference to which you can write js that will show this form.

Find more questions by tags BootstrapHTMLJavaScriptPHP