Reputation: 425
I'm using the simple following code to create a form and receive its values in another page:
firstpage.php
<form action="checklogin.php" method="post" >
<table border=1>
<tr><td>Username </td><td><input type="text" name="txtuser" /></td></tr>
<tr><td>Password </td><td><input type="text" name="txtpwd" /></br>
</td></tr>
<tr><td><input type="submit" value="Login now" name="btnsub"/>
</table>
</form>
checklogin.php
<html>
<body>
Welcome <?php echo $_POST['txtuser']; ?>
</body>
</html>
This code does not show the value of the input txtuser
in the nxtpage.php in all browsers.
Upvotes: 1
Views: 2305
Reputation: 4286
Is your form target checklogin.php or nxtpage.php? Since if it is checklogin.php, quite naturally nxtpage.php will not receive the POST variables sent to checklogin.php.
Unless you're just doing something very simple, you want to use sessions - for example, see this tutorial about sessions.
Upvotes: 0
Reputation: 799190
You're POSTing to checklogin.php
. Of course nextpage.php
won't have the POST value. Try sticking it in the session.
Upvotes: 3