title: Display alert message that's inside an action file, in another file
body: <p>So I have this php action file:</p>
  
  <pre><code>&lt;?php
  session_start();
  require 'config.php';
  if (isset($_POST['action']) &amp;&amp; $_POST['action'] == 'signup') {
  
      $stmt1 = "SELECT * FROM users where username='" . $_POST['username'] . "'";
      $ret1 = mysqli_query($conn, $stmt1);
      $rowcount1 = mysqli_fetch_assoc($ret1);
      if (empty($rowcount1)) {
  
  
          $query = "INSERT INTO users (username, password, email, cpf)VALUES( '" . $_POST['username'] . "', '" . $_POST['password'] . "', '" . $_POST['email'] . "', '" . $_POST['cpf'] . "')";
          //echo $query;exit;
          echo  mysqli_query($conn, $query);
      } else {
          header("Location:signup.php");
          echo '&lt;script language="javascript"&gt;';
          echo 'alert("User is already registered.")';
          echo '&lt;/script&gt;';
      }
  }
  </code></pre>
  
  <p>This else statement becomes true because I can see it in the console, but, I'm trying to display this alert message in another file called "signup.php".</p>
  
  <p>I want to display the alert message right inside this small div:</p>
  
  <pre><code>&lt;div class="cont"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried to do it with "header("Location:signup.php");" as you can see but no idea on how to make it work.</p>
  
  <p>Any ideas on how I can do that?</p>