【发布时间】:2018-11-15 16:42:37
【问题描述】:
<!--first page [p1.php]-->
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method = 'post' action = 'p2.php'>
Form <input type = 'text' name = 'form' /><br><br>
<input type = 'submit' value = 'Next' />
</form>
</body>
</html>
<!--second page [p2.php]-->
<?php
//Log inputs
$form = $_POST['form'];
//Echo variables
echo "
<form method = 'post' action= 'p3.php'>
$form<br>
<b>Question 1: </b>Type websites's name<br>
<b>Website </b><input type = 'text' name = 'website' /><br><br>
<input type = 'submit' value = 'Submit' />
</form>
";
?>
<!--page 3 [p3.php]-->
<?php
//Log inputs
$form= $_POST['$form'];
$website = $_POST['website'];
//Echo variables
echo "$form $website<br>";
?>
On [p3.php] it gives me an error stating:
注意:未定义的索引:第 3 行 [p3.php 的路径] 中的表单 堆栈溢出
如何使 p3.php 显示 p2.php 中的 $form 和 $website?
【问题讨论】:
-
请将每段代码分开
标签: php variables undefined-index