在php上回显我的表单值 [英] echo my form values on php
问题描述
我正在使用下面的代码来打印插入框中的值。然而,当我把值,然后点击提交没有打印出来。
< html>
< body>
< form action =<?php $ _SERVER ['PHP_SELF']?>方法= POST >
名称:< input type =textname =name>< br>
电子邮件:< input type =textname =email>< br>
< input type =submit>
< / form>
<?php
if(isset($ _ POST [submit])){
$ name = filter_input(INPUT_POST,'name');
$ email = $ _POST ['email'];
echo $ name;
echo $ email;
}
?>
< / body>
< / html>
关于下面我试过这两种情况,因为在简单的$ _POST ['email']警告:
$ name = filter_input(INPUT_POST,'name');
$ email = $ _POST ['email'];
警告:
直接访问超全局$ _POST数组
我使用Netbeans IDE 8.2。
<
if(isset($ _POST [submit])){
改为:
if(count($ _ POST)> 0){
您没有任何匹配 name =submit
的元素。另外,使用 isset($ _ POST [submit])
是一种不好的做法,因为我们很多人都不会将其命名。
如果您想检查设置的具体内容,您需要执行以下操作:
<$ c $ ($ _ POST ['email'])){
如果你还想让你的代码在上面的设置中工作,请添加一个 Am using the code below in order to print the values that am inserting on the boxes. However After I put the values and click submit nothing is printing out. About below I tried both cases because on the simple one $_POST['email'] I was getting a warning: Warning: Do not Access Superglobal $_POST Array Directly I am using Netbeans IDE 8.2. This is never set: Instead change it to: You don't have any elements matching If you want to check for specific things set, like in your case, you need to do: If still you wanna make your code work with the above set-up, kindly add a
这篇关于在php上回显我的表单值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! name $ c
$ p $ < code>< code>< code>< input type =提交name =submitvalue =提交/>
<html>
<body>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
<?php
if(isset($_POST["submit"])) {
$name = filter_input(INPUT_POST, 'name');
$email = $_POST['email'];
echo $name;
echo $email;
}
?>
</body>
</html>
$name = filter_input(INPUT_POST, 'name');
$email = $_POST['email'];
if (isset($_POST["submit"])) {
if (count($_POST) > 0) {
name="submit"
. Also, it is a bad practise to use isset($_POST["submit"])
as many of us, won't name it.if (count($_POST) > 0 && isset($_POST["name"]) && isset($_POST['email'])) {
name
and value
here:<input type="submit" name="submit" value="Submit" />