我是PHP的新手,我在下面提到了我的HTML和PHP代码。我无法将文本框值获取到PHP。我在下面提到了HTML和PHP代码。
HTML代码:
Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br>
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">
PHP代码:
$tx0 = $_POST["f_b1_s1_sec"];
$tx1 = $_POST["f_b1_s1_con"];
$tx2 = $_POST["f_b1_s1_para"];
请澄清。
谢谢!
答案 0 :(得分:2)
试试这个:
<?php
if( isset( $_POST["go"] ) {
$tx0 = $_POST["f_b1_s1_sec"];
$tx1 = $_POST["f_b1_s1_con"];
$tx2 = $_POST["f_b1_s1_para"];
}
?>
<form action="insertyourphp.php" method="post">
Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br>
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">
<input type="submit" name="go" value="Go">
</form>