我想在PHP中获取文本框的值,当我尝试这个时:
<form method=post action="update.php">
<input type="text" name="Hex" />
<input type="submit" value="OK" />
</form>
Run Code Online (Sandbox Code Playgroud)
<?php
$test = $_POST['Hex'];
echo $test;
?>
Run Code Online (Sandbox Code Playgroud)
我刚收到错误:
未定义的索引:十六进制
我用Google搜索无济于事; 所以请有人帮助我!
小智 6
我希望这可以帮到你:
<?php
if (isset($_POST['submit'])) {
$test = $_POST['Hex'];
echo $test;
} else { ?>
<form method="post" action="">
<input type="text" name="Hex" />
<input type="submit" value="OK" name="submit" />
</form>
<?php } ?>
Run Code Online (Sandbox Code Playgroud)
我认为问题在于引号,@ GuiceU你忘了添加引号发布.
只需用method ="post"替换你的method = post
HTML代码:
<form method="post" action="update.php">
<input type="text" name="Hex" />
<input type="submit" value="OK" />
</form>
Run Code Online (Sandbox Code Playgroud)
php代码:
<?php
$test = $_POST['Hex'];
echo $test;
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24702 次 |
| 最近记录: |