Php post内容的空白输出

Php post内容的空白输出,php,post,echo,Php,Post,Echo,当我回显帖子内容或将其插入数据库时,我总是得到空白结果$ 这是我的密码 PHP <?php $host = "mysql.1freehosting.com"; $user = "u249494946_user"; $pass = "aqwaqwaqw"; $db = "u249494946_first"; mysql_connect($host,$user,$pass); mysql_select_db($db); /*if(isset($_post["ajout"])) { ech

当我回显帖子内容或将其插入数据库时,我总是得到空白结果$ 这是我的密码

PHP

<?php

$host = "mysql.1freehosting.com";
$user = "u249494946_user";
$pass = "aqwaqwaqw";
$db = "u249494946_first";

mysql_connect($host,$user,$pass);
mysql_select_db($db);

/*if(isset($_post["ajout"])) {
echo("error submitting");
}
else {
*/
var_dump(isset($_post['submit']));
$nom = $_post["nom"];
$prenom = $_post["prenom"];
echo $_post[nom];
echo $nom;
$result1=mysql_query("INSERT INTO eleve (id,nom,prenom) VALUES (NULL,'$nom','$prenom')");var_dump($result1);
/*$result2=mysql_query("INSERT INTO eleve(id, nom, prenom) VALUES (null,'y','y')");
if(!$result1){
die('errreur result1 :' . mysql_error());
}
*/
var_dump($_POST);

?>

它应该是
echo$_POST[“nom”]而不是
echo$_post[nom]

编辑: 您需要将名称属性添加到表单输入中,例如
$\u POST
是一个字母,必须是大写字母

将所有
$\u post
更改为
$\u post

另外,正如
Alon
所述,您需要命名您的输入元素:

<input type="text" id="nom" name="nom" />

它实际上是
Alon
:)bool(false)bool(true)数组(0){}现在数组总是0哦,天哪,我真诚地道歉,我读得太快了。我会马上补救的@你的
也没有名字。查看我的编辑,或更改为
@MahmoudSenSeiAh好,这是一个好消息@MahmoudSenSei,不客气。
bool(false)
bool(true)
array(3) {
  ["nom"]=>
  string(7) "example"
  ["prenom"]=>
  string(7) "example"
  ["submit"]=>
  string(7) "ajouter"
}
<input type="text" id="nom" name="nom" />
nom : <input type="text" id="nom" name="name" />
prenom : <input type="text" id="prenom" name="prenom" />
<input type="submit" value="ajouter" name="submit" id="submit" />