开发者

$_POST not showing results

开发者 https://www.devze.com 2023-03-08 14:24 出处:网络
I\'m using the simple following code to create a form and receive its values in another page: firstpage.php开发者_StackOverflow

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号