Redirect after form submission?

Hello, there is form with method POST when the form submission is triggered the handler in php , depending on the selected radio button is redirect the form to a specific page, the handler everything works fine, only fails redirect
<script language="JavaScript" type="text/javascript">
 var lpLocation = document.querySelector("#wrapper_form_radio input:checked").value;
 if (lpLocation == "eccomerce") {
 location = 'url1';
 } else if (lpLocation == "exchange") {
 location = 'url2';
 } else if (lpLocation == "paymants") {
 location = 'url3';
}
</script>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 if (isset($_POST['formData'])) {$formData = $_POST['formData'];}
 if (isset($_POST['contact-1'])) {$contactForm = $_POST['contact-1'];}
 if (isset($_POST['contact'])) {$social = $_POST['contact'];}
 if (isset($_POST['mail'])) {$mail = $_POST['mail'];}
 $to = "email"; /*Specify your e-mail address*/
 $headers = "Content-type: text/plain; charset = utf-8";
 $subject = "opisanie";
 $message = "";
 $send = mail ($to, $subject, $message, $headers);
?>

I will be grateful for the help and clarification
April 4th 20 at 13:25
1 answer
April 4th 20 at 13:27
because it is (a redirect) there is no
Tell me how to implement it? if using header(location)
I can't understand how can I make a condition on value in input - Zola46 commented on April 4th 20 at 13:30
@Zola46, https://stackoverflow.com/questions/503093/how-do-...
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
- kory.Volkm commented on April 4th 20 at 13:33
@kory.Volkm, sorry it turns out instead of location
I use
window.location.replace("http://stackoverflow.com");

right I understand? - Zola46 commented on April 4th 20 at 13:36

Find more questions by tags PHPJavaScript