【发布时间】:2016-11-03 04:34:09
【问题描述】:
如何在当前页面显示用户在登录页面输入的NAME字段数据?
详情
1.用户将在下面的页面中输入用户名和密码,该页面保存为“home.html”。
<form action="indexpage.php" method="post">
<p>Username</p>
<input name="myusername" type="text" id="myusername" required>
<p>Password</p>
<input name="mypassword" type="password" id="mypassword"required></br>
<button><img src="http://icons.iconarchive.com/icons/webiconset/application/32/Register-icon.png" /></button>
</form>
2.点击登录按钮后,这将重定向到这个页面(下面是脚本)并保存为“indexpage.php”。
<html>
<form method="post" action="insert1.php">
<div style="text-align:center">
<button>INSERT<img src="http://brandonmadeawebsite.com/images/art/icons/insert_icon.png" height="30" /></button> </div>
</form>
</html>
3.现在如果我从选项中选择插入选项,它将重定向到“insert1.php”页面
<p>
<label>ENTER NAME</label>
<input type="text" name="name" value="<?php print $myusername; ?>" required>
我正在尝试在进入此页面后立即打印 USERNAME 字段。
请帮助我,在此先感谢
【问题讨论】:
-
您可以将此数据保存到
session,然后通过$_SESSION在其他页面上使用 -
当您将公式数据发送到“indexpage.php”时,数据将保存在
$_POST数组中。因此您可以通过$_POST['myusername']访问用户名,例如