Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将信息从表单发布到xampp时未定义索引_Php_Html - Fatal编程技术网

Php 将信息从表单发布到xampp时未定义索引

Php 将信息从表单发布到xampp时未定义索引,php,html,Php,Html,这是我的密码 我一直在php端使用未定义的索引,但我想我已经清楚地从表单端发布了正确的信息,但仍然。。。 请帮帮我!!!请帮帮我!!!请帮帮我!!!请帮帮我!!!请帮帮我 <form class="modal-content animate" action="TenantSdb.php"> <div class="container"> <label><b>Username</b></label> <input

这是我的密码 我一直在php端使用未定义的索引,但我想我已经清楚地从表单端发布了正确的信息,但仍然。。。 请帮帮我!!!请帮帮我!!!请帮帮我!!!请帮帮我!!!请帮帮我

<form class="modal-content animate" action="TenantSdb.php">
<div class="container">
  <label><b>Username</b></label>
  <input type="text" placeholder="Enter Username" name="uname" required>

  <label><b>Password</b></label>
  <input type="password" placeholder="Enter Password" name="psw" required>

  <label><b>Email address</b></label>
  <input type="text" placeholder="Enter Email" name="email" required>

  <label><b>Contact No</b></label>
  <input type="text" placeholder="Enter Contact" name="contact_no" required>

  <label><b>Looking for which area</b></label>
  <input type="text" placeholder="Enter Area" name="area" required>

  <label><b>Gender</b></label>
  <input type="text" placeholder="Enter Gender" name="gender" required>

  <label><b>Age</b></label>
  <input type="text" placeholder="Enter Age" name="age" required>

  <label><b>Max Budget</b></label>
  <input type="text" placeholder="Enter Budget" name="max_budget" required>

  <label><b>Staying With</b></label>
  <input type="text" placeholder="Enter Staying with" name="staying_with"
  required>

  <label><b>Race</b></label>
  <input type="text" placeholder="Enter Race" name="race" required>



  <button type="submit">Sign Up</button>
  <input type="checkbox" checked="checked"> Remember me
</form>
</div>

用户名
暗语
电子邮件地址
联系电话
在找哪个地区
性别
年龄
最高预算
与
比赛
注册
记得我吗
`
$servername=“localhost”;
$dbusername=“root”;
$dbpassword=“”;
$dbname=“tenantsdb”;
$uname=$_POST['uname'];
$psw=$_POST['psw'];
$email=$_POST['email'];
$contact_no=$_POST['contact_no'];
$area=$_POST['area'];
$gender=$_POST['gender'];
$age=$_POST['age'];
$max_budget=$_POST['max_budget'];
$staming_with=$_POST['staming_with'];
$race=$_POST['race'];
$conn=newmysqli($servername、$dbusername、$dbpassword、$dbname);
如果($conn->connect\u错误)
{
die(“连接失败:”.$conn->connect\U错误);
}
$sql=“插入到租户签名中”
(uname、psw、电子邮件、联系人、地区、性别、最高预算、住宿、种族)价值观
(“$uname”、“$psw”、“$email”、“$contact_no”、“$area”、“$gender”、“$max_budget”,
“$staming_with”“,$race”“”;
if($conn->query($sql)==TRUE)
{
回声:“谢谢!”;
}
其他的
{
回显“错误”。$sql。“$conn->错误;
}
$conn->close();
?> 
我正在从中获取未定义的索引
$uname=$_POST['uname'];
$psw=$_POST['psw'];
$email=$_POST['email'];
$contact_no=$_POST['contact_no'];
$area=$_POST['area'];
$gender=$_POST['gender'];
$age=$_POST['age'];
$max_budget=$_POST['max_budget'];
$staming_with=$_POST['staming_with'];
$race=$_POST['race'];
继续从顶部获取未定义的索引^^^^,有人能告诉我这个问题吗?
请帮帮我,非常感谢

您已经指定了属性
method='POST'

<form class="modal-content animate" action="TenantSdb.php" method="POST">


默认方法是
GET
。因此,如果不指定方法,则只能通过使用
$\u GET

访问它,您必须指定方法,否则默认值将为GET方法。若您不知道表单中具体使用了什么方法,那个么就使用$\u请求$_请求可以发布数据,也可以获取数据。这两种方法都适用。

是的,没错……我改成了method=“post”,而且很有效……非常感谢:)@PerryPuah Happy coding。。。!谢谢@Harikrishnan
<form class="modal-content animate" action="TenantSdb.php" method="POST">