$_POST not showing results
I'm using the simple following code to create a form and receive its values in another page:
firstpage.php 开发者_StackOverflow
<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.
You're POSTing to checklogin.php
. Of course nextpage.php
won't have the POST value. Try sticking it in the session.
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.
Read this passing variable to another page.
精彩评论