-1

hello i have a page where users can register, and so after registeration i want to pass the username and password from my registeration form to another form on a next page, mean while this form on the next page should hold username and password values that are passed from the first page.

the form is echoed correctly but the values dont come correctly.

this is what i ahve tried

echo '<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="one" id="one">
              <input type="text" placeholder="Username" name="Username" value="<?php echo $_POST["Username"]; ?>" >
              <p>&nbsp;</p>
              <input type="password" placeholder="Password" name="Password" value="<?php echo $_POST["Password"]; ?>">
              <br>
              <input name="Submit" type="submit" class="btn" value="Sign In" />

              </form>';

but the values dont come out, is there a right way to echoe this thanks

2 Answers2

0
echo '<form ACTION="'.$loginFormAction.'" METHOD="POST" name="one" id="one">
              <input type="text" placeholder="Username" name="Username" value="'.$_POST["Username"].'" >
              <p>&nbsp;</p>
              <input type="password" placeholder="Password" name="Password" value=".'$_POST["Password"].'">
              <br>
              <input name="Submit" type="submit" class="btn" value="Sign In" />

              </form>';

Try This And Reply

Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
  • it works but i am now having this error Notice: Undefined variable: loginFormAction in C:\xampp\htdocs\kbluser\connect.php on line 29, which has to do with form action – tolu odumbo Feb 17 '15 at 14:39
  • then give some value to the variable $loginFormAction eg. $loginFormAction="targetfile.php" – Varun Naharia Feb 17 '15 at 14:41
0

You don't do this with echo, because the echo is just some HTML on the other page. You can also save them.

What you want is a form most likely:

Page 1

<form action="page2.php" method="post">
    Name:  <input type="text" name="username" /><br />
    <input type="submit" name="submit" value="Send" />
</form>

Page2

<?php
echo "Your sent username: ", $_POST['username'];
?>
Gintoki
  • 142
  • 2
  • 16