Php 表格提交不明索引
我试图在同一页上提交表单,但出现以下错误: 未定义索引:text1 以及: 未定义的索引:text2 以下是我正在使用的代码:Php 表格提交不明索引,php,html,forms,submit,Php,Html,Forms,Submit,我试图在同一页上提交表单,但出现以下错误: 未定义索引:text1 以及: 未定义的索引:text2 以下是我正在使用的代码: <?php include('includes/header.php') ?> <section class="login"> <?php if (isset($_POST['submitbtn'])) { $text1 = $_POST['text1']; $text2 = $_POST['
<?php include('includes/header.php') ?>
<section class="login">
<?php
if (isset($_POST['submitbtn'])) {
$text1 = $_POST['text1'];
$text2 = $_POST['text2'];
echo "Success! You entered: " . $text1 . "<br>";
echo "Success! You entered: " . $text2 . "<br>";
} else {
?>
<form action="" method="post">
<p><label>Text1:</label><input type="text" name"text1"/></p>
<p><label>Text2:</label><input type="text" name"text2"/></p>
<input type="submit" name="submitbtn"/>
</form>
<?php } ?>
</section>
<?php include('includes/footer.php') ?>
正文1:
文本2:
- php包含一个html导航,它打开到的连接 数据库
- php具有页脚并关闭连接
我做错了什么?还有没有更好的方法在同一页上提交表单?忘记
=
中的名称“text1”
。是的
<p><label>Text1:</label><input type="text" name="text1"/></p>
<p><label>Text2:</label><input type="text" name="text2"/></p>
Text1:
文本2: