Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.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中的isset不起作用_Php_Isset - Fatal编程技术网

php中的isset不起作用

php中的isset不起作用,php,isset,Php,Isset,我必须从该表单中获取数据并将其插入数据库。 我无法在线找到任何解决方案。 所有功能都在浏览器上运行,但数据没有存储到表中,如果块没有在屏幕上打印,则会在其中进行回显。 代码如下所示 HTML <form action="" method="POST"> <div class="container-fluid"> <div class="container"> <div class="row">

我必须从该表单中获取数据并将其插入数据库。
我无法在线找到任何解决方案。
所有功能都在浏览器上运行,但数据没有存储到表中,如果块没有在屏幕上打印,则会在其中进行回显。 代码如下所示

HTML

    <form action="" method="POST">
    <div class="container-fluid">
      <div class="container">
       <div class="row">
          </div>

  <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-10 col-lg-4 col-md-offset-3" style="top:100px">
            <div class="offer offer-radius offer-primary">
                <div class="shape">
                    <div class="shape-text">
                        <span class="glyphicon glyphicon-user"></span>
                </div>
            </div>
                <div class="offer-content">
                     <h4 style="margin-left:70px;font-size:20px">Enter your details below and enroll your slot</h4>

          <div class="container col-xs-12">
              <div class="stepwizard">
                  <div class="stepwizard-row setup-panel">
                      <div class="stepwizard-step">
                          <a href="#step-1" type="button" class="btn btn-primary btn-circle">
                          <i class="glyphicon glyphicon-user" style="margin-left: -18px;top: -24px;font-size: 90%;"></i></a>
                  </div>
                      <div class="stepwizard-step">
                          <a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled">
                          <i class="glyphicon glyphicon-education" style="margin-left: -18px;top: -24px;font-size: 90%;"></i></a>
                  </div>
                      <div class="stepwizard-step">
                          <a href="#step-4" type="button" class="btn btn-default btn-circle" disabled="disabled">
                          <i class="glyphicon glyphicon-ok" style="margin-left: -18px;top: -24px;font-size: 90%;"></i></a>
                  </div>
              </div>
          </div>

              <div class="row setup-content" id="step-2">
                  <div class="col-xs-12">
                      <div class="col-md-10">
                          <h3>Qualification</h3>
                          <div class="col-xs-12 col-xs-offset-1" style="top:-50px">
                            <button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
                      </div>
                          <div class="col-xs-12" style="clear:both;top:-45px">
                          <input  maxlength="20" type="text" required="required" class="form-control" placeholder="B Tech" readonly="" />
                      </div>
                            <div class="col-xs-12 form-group" style="clear:both;top:-40px">
                                    <label for="subject">
                                    Year of Pass out</label>
                                        <input  maxlength="20" type="text" required="required" class="form-control" placeholder="2016" readonly="" />
                            </div>
                                <div class="col-xs-12 form-group" style="clear:both;top:-40px">
                                        <label for="subject">
                                        Branch</label>
                                        <select id="subject" name="subject" class="form-control" required="required">
                                            <option value="na" selected="">Choose One:</option>
                                            <option value="service">Computer Science</option>
                                            <option value="suggestions">Information Technology</option>
                                            <option value="product">Electronics & Communication</option>
                                            <option value="product">Electronics & Electrical</option>
                                            <option value="product">Instrumentation</option>
                                    </select>
                                </div>
                                    <div class="col-xs-12" style="clear:both;top:-40px">
                                    <label for="subject">
                                    Percentage (%)</label>
                                    <input  maxlength="6" type="text" class="form-control" placeholder="Your Percentage" name="percentage" />
                                </div>
                      </div>
                  </div>
              </div>
          </div>

          <div class="row setup-content" id="step-1">
              <div class="col-xs-12">
                  <div class="col-md-12">
                      <div class="container">
                            <div class="row">
                                <div class="col-xs-4">
                                <button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
                                    <h3>Personal Information</h3>
                                    <div class="col-xs-12" style="padding:15px">
                                        <div class="input-group">
                                      <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
                                      <input  maxlength="100" type="text" class="form-control" placeholder="First Name" name="F_Name" />
                                </div>
                                </div>
                                    <div class="col-xs-12" style="clear:both;padding:10px">
                                        <div class="input-group">
                                      <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
                                      <input  maxlength="100" type="text" class="form-control" placeholder="Last Name" name="L_Name"  />
                                </div>
                                </div>
                                    <div class="col-xs-12" style="clear:both;padding:10px">
                                        <div class="input-group">
                                      <span class="input-group-addon"><i class="fa fa-envelope fa" aria-hidden="true"></i></span>
                                      <input  maxlength="100" type="text" class="form-control" placeholder="Your Email" name="EmailID" />
                                </div>
                                </div>
                                    <div class="col-xs-12" style="clear:both;padding:10px">
                                        <div class="input-group">
                                      <span class="input-group-addon"><i class="fa fa-phone fa" aria-hidden="true"></i></span>
                                      <input  maxlength="14" type="text" class="form-control" placeholder="(+91) 555-555-5555" name="Phone_Number" />
                                </div>
                                </div>
                                    <div class="col-xs-12" style="clear:both;padding:10px">
                                        <div class="input-group">
                                      <span class="input-group-addon"><i class="fa fa-phone fa" aria-hidden="true"></i></span>
                                      <input  maxlength="14" type="text" class="form-control" placeholder="Reference Code" name="R_Code" />
                                </div>
                                </div>
                            </div>
                    </div>
                    </div>
                  </div>
              </div>
          </div>
      </div>
              <div class="row setup-content" id="step-4">
                  <div class="col-xs-12">
                      <div class="col-xs-12">
                          <div class="container" style="height:307px;">
                           <h4>Registered</h4>
                           <div class="col-xs-4" style="margin-left:-60px;top:60px">
                             <a href="#"><button class="btn btn-success completeBtn btn-lg pull-right" type="button" name="proceed">Proceed to payment</button></a>
                       </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>
      </div>

      </div>
    </div>
  </div>
        </div>
    </div>

</form>

在下面输入您的详细信息并注册您的插槽
资格
下一个
昏迷年份
分支机构
选择一个:
计算机科学
信息技术
电子与通信
电子与电气
仪器仪表
百分比(%)
下一个
个人信息
登记
PHP

    <?php
$cn= mysqli_connect('localhost','testuser','password','invoicedb');
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
echo "string";

if(isset($_POST["proceed"]))
{echo "string";

  $fname=$_POST['F_Name'];
  $lname=$_POST['L_Name'];
  $emailID=$_POST['EmailID'];
  $phone_number=$_POST['Phone_Number'];
  $reference_code=$_POST[‘R_Code’];
  $branch=$_POST[‘subject’];
  $percentage=$_POST[‘percentage’];

echo "insert into students(first_name,last_name,email,phone_number,reference_code,branch,percentage) VALUES ('$fname','$lname','$emailID','$phone_number','$reference_code','$branch','$percentage')";

mysqli_query($cn,"insert into students(first_name,last_name,email,phone_number,reference_code,branch,percentage) VALUES ('$fname','$lname','$emailID','$phone_number','$reference_code','$branch','$percentage')");
//best outside the if statement so user isn't stuck on a white blank page.
header("location:confirm.php");
exit;
}
?>

只有在提交表单后才能访问
$\u POST[]
值,
那么换掉这个,

<a href="#"><button class="btn btn-success completeBtn btn-lg pull-right" type="button" name="proceed">Proceed to payment</button></a>

有了这个,

<a href="#"><button class="btn btn-success completeBtn btn-lg pull-right" type="submit" name="proceed">Proceed to payment</button></a>

如果(设置($\u POST[“继续”]){}

$\u POST[“继续”]
根本没有设置,它需要一个值来确保它已设置

不必检查是否提交,只需打印post值并尝试是否提交表单即可

在php标记内,编写下面的代码,并尝试回显数据

echo '<pre>';

print_r($_POST);

echo '----------------';

print_r($_REQUEST);
echo';
打印(邮政美元);
回音'-------------';
打印请求($);

如果您在同一页中提交表格,则应使用-


您可以访问
$\u POST[]
值如果表单已提交,请使用
按钮
type=submit
。使用type=“submit”
    <?php
$cn= mysqli_connect('localhost','testuser','password','invoicedb');
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
echo "string";

if($_SERVER["REQUEST_METHOD"] == "POST")
{echo "string";

  $fname=$_POST['F_Name'];
  $lname=$_POST['L_Name'];
  $emailID=$_POST['EmailID'];
  $phone_number=$_POST['Phone_Number'];
  $reference_code=$_POST[‘R_Code’];
  $branch=$_POST[‘subject’];
  $percentage=$_POST[‘percentage’];

echo "insert into students(first_name,last_name,email,phone_number,reference_code,branch,percentage) VALUES ('$fname','$lname','$emailID','$phone_number','$reference_code','$branch','$percentage')";

mysqli_query($cn,"insert into students(first_name,last_name,email,phone_number,reference_code,branch,percentage) VALUES ('$fname','$lname','$emailID','$phone_number','$reference_code','$branch','$percentage')");
//best outside the if statement so user isn't stuck on a white blank page.
header("location:confirm.php");
exit;
}
?>