PHP Form not passing variables to second form

Wille G

I have a PHP Form that for the life of me I cannot get to pass variables to second page. Iven tried everything I can do with no luck. The variables are not passing to CheckUser.php.

FORM:

    <?php
    $Page = "Home";
    ?>

    <?php
    require "CheckUser.php";
    ?>

    <div> 
      <form id="login-form" method="post" target="_self" autocomplete="off">
        <label for="user">User Name</label>
        <input type="text" name="User" required />
        <label for="password">Password</label>
        <input type="password" name="Password" required />
        <input type="submit" value="Sign In"/>
        <input type="hidden" name="Page" value="<?=$Page?>" />
      </form>
    </div>

CheckUser.php:

<?php

$Page = $_GET['Page'];
$Password = $_GET['Password'];
$User = $_GET['User'];

echo"Page: $Page <br />";
echo"Password: $Password <br />";
echo"User $User <br />";

?>
IMSoP

$_GET contains parameters passed on the query string (at the end of the URL). Those would be present if your form said method="get".

Your form says method="post", so the parameters are instead passed in the body of the HTTP request (not in the URL). To get those, you use $_POST instead of $_GET.

Note that both can be present, e.g. your form could have method="post" but also action="/process.php?stage=2". Then $_GET['stage'] would be '2', and the form fields would be in $_POST.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive