我阅读了关于 SO 和 google 的所有相关问题,但仍然无法得到相同的答案。
这是我的 html 表单代码
<form id="Form1" name="Form1" method="post" action="page1.php" enctype="multipart/form-data">
Your Name:<input type="text" class="input" name="txtUserName">
Your Email:<input type="text" class="input" name="txtUserEmail">
<input type="submit" name="submit" value="Submit">
</form>
这是我的这个页面的 php 代码 (page1.php) // 我将这些变量转移到其他页面 page2.php
<?php
$values['txtUserName'] = 'username';
$values['txtUserEmail'] = 'useremail';
header( 'Location: page2.php' );
?>
这是page2.php的监听代码
<?php
$username = $_GET['username'];
$useremail = $_GET['useremail'];
?>
在 html 页面下方的某个地方
<div class="text1">
<?php echo $username; ?>
<?php echo $useremail; ?>
</div>
- 我收到未定义索引用户名和 useremail 的通知
回声不显示任何内容..我错在哪里?
另外,如果我不想将表单值转移到第二页,而是将变量 $username 转移到第二页.. 那怎么办?