0

hello after the form is completed a blankpage with php insertion are shown but instead id like to be redirect to another page

<body>
    <div class="main-block">
      <form action="insertion.php" method="GET">
        <div class="title">
          <i class="fas fa-pencil-alt"></i>
          <h2>Vos informations</h2>
        </div>
        <div class="info">
          <input class="fname" type="text" required value="" name="prenom" placeholder="Prenom" />
          <input class="lname" type="text" required value="" name="nom" placeholder="Nom" />
          <input type="text" name="email" required value="" placeholder="Email" />
          <input type="text" name="telephone" required value="" placeholder="Numéro de téléphone" />
          <input type="password" name="mot_de_passe" required value="" placeholder="Mot de passe" />
        </div>
        <div class="checkbox"><input type="checkbox" name="checkbox" onclick="reset_msg();" /><span>Les informations sont exactes</span></div>
        <div id="msg"></div>
        <button type="submit" value="send" id="bouton" onclick="return send();" href="/">Envoyez</button>
      </form>
    </div>
  </body>
PL lema
  • 11
  • 2
  • Does this answer your question? [How do I make a redirect in PHP?](https://stackoverflow.com/questions/768431/how-do-i-make-a-redirect-in-php) – AD7six Oct 18 '22 at 19:39

1 Answers1

0

Since the action is sent to insertion.php, you should do redirection in that file. You can accomplish that by setting header location after your insertion process. For example:

<?php 
// YOUR INSERTION CODE HERE
// ...
// ...

header('Location: ' . $redirectURL);
exit();
?>
Cafer Elgin
  • 393
  • 2
  • 12
  • this is what ive done but i get this error... Warning: Cannot modify header information - headers already sent by (output started at /storage/ssd5/116/19730116/public_html/connexion.php:10) in /storage/ssd5/116/19730116/public_html/insertion.php on line 24 – PL lema Oct 18 '22 at 20:06
  • It says check line 10 in your connection.php. You should not send output before writing header. – Cafer Elgin Oct 20 '22 at 04:21