请帮助我。我知道这是个愚蠢的问题(我是新来的)。
但是我已经数百万次检查过此代码,但是我没有发现错误。
PS:-此代码未显示错误,但仍未插入数据库。
请帮助
<!------------------------------html file---------------------------------!>
<div class="container-fluid">
<div class="card">
<div class="upper">
<div class="card-header card-set">
<h1 class="display-4">Apply To BFGI</h1>
</div>
</div>
<div class="card-body">
<form id="form1" autocomplete="off" class="wow zoomIn">
<div class="row">
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Institutions</h4></label>
<select name="institution" class="form-control" required="required">
<option value="">Select</option>
<option value="Baba Farid College of ENGG. & Tech">Baba Farid College of ENGG. & Tech</option>
<option value="Baba Farid College of MGT. & Tech">Baba Farid College of MGT. & Tech</option>
<option value="Baba Farid College">Baba Farid College</option>
<option value="Baba Farid College Of Education">Baba Farid College Of Education</option>
<option value="Baba Farid Public Sr. Sec. School">Baba Farid Public Sr. Sec. School</option>
<option value="School Of Internationl Studies">School Of Internationl Studies</option>
<option value="School Of Compititive Studies">School Of Compititive Studies</option>
<option value="School Of Entrepreneurship Studies">School Of Entrepreneurship Studies</option>
</select>
</div>
</div>
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Category</h4></label>
<select name="position" class="form-control" required="required">
<option value="" disabled="disabled" selected="selected">Select</option>
<option value="Faculty Positions">Faculty Positions</option>
<option value="Academic Positions">Academic Positions</option>
<option value="Non Academic Positions">Non Academic Positions</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Position</h4></label>
<select name="positionname" class="form-control" required="required">
<option value="" disabled="disabled" selected="selected">Select</option>
<option value="Assistant Professor">Assistant Professor</option>
<option value="Professor">Professor</option>
<option value="Dean">Dean</option>
<option value="Director">Director</option>
<option value="Pro-VC">Pro-VC</option>
<option value="Account Officer">Account Officer</option>
<option value="Academic Coordinators">Academic Coordinators</option>
<option value="Hostel Warden">Hostel Warden</option>
<option value="Secretary / Office Assistant">Secretary / Office Assistant</option>
</select>
</div>
</div>
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Department</h4></label>
<select name="department" class="form-control" required="required">
<option value="" disabled="disabled" selected="selected">Select</option>
<option value="CSE - Computer Science Eng.">CSE - Computer Science Eng.</option>
<option value="ME - Mechanical Eng.">ME - Mechanical Eng.</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Nature of Job</h4></label>
<select name="natureofjob" class="form-control" required="required">
<option value="" disabled="disabled" selected="selected">Select</option>
<option value="Full Time">Full Time</option>
<option value="Part Time">Part Time</option>
</select>
</div>
</div>
<div class="col-md-6 col-lg-6">
<div class="form-group">
<label class="control-label"><h4>Came to know through</h4></label>
<select name="cametoknow" class="form-control" required="required">
<option value="" disabled="disabled" selected="selected">Select</option>
<option value="Advertisement">Advertisement</option>
<option value="BFGI Website">BFGI Website</option>
<option value="Newspaper">Newspaper</option>
<option value="Search Engine">Search Engine</option>
<option value="Television">Television</option>
</select>
</div>
</div>
</div>
<input type="button" class="btn btn-lg btn-outline-primary" required="on" value="submit" id="btn1">
</form>
<form id="form2" class="wow zoomIn"> //just for understandig of code
</form>
<!-- begin snippet: js hide: false console: true babel: false -->
<script>
$(function(){
$('#btn1').click(function(){
var post = $('#form1').serialize();
$.ajax({
url:'class.php',
method:'POST',
data:post,
success:function(response)
{
if(response=='eror')
{
$('#result').html(response);
}
else
{
$('#form1').hide();
$('#form2').show();
}
}
});
});
});
</script>
<script>
$(function(){
$('#btn1').click(function(){
var post = $('#form1').serialize();
$.ajax({
url:'class.php',
method:'POST',
data:post,
success:function(response)
{
if(response=='eror')
{
$('#result').html(response);
}
else
{
$('#form1').hide();
$('#form2').show();
}
}
});
});
});
</script>
<script>
$(function(){
$('#btn1').click(function(){
var post = $('#form1').serialize();
$.ajax({
url:'class.php', //the php file name
method:'POST',
data:post,
success:function(response)
{
if(response=='eror')
{
$('#result').html(response);
}
else
{
$('#form1').hide(); //there are two forms.. if one form submit second form show
$('#form2').show();
}
}
});
});
});
</script>
请帮助
答案 0 :(得分:0)
$insert=$this->connect->prepare("INSERT INTO first_page(institution,position,positionname,department,natureofjob,cametoknow) VALUES(?, ?, ?, ?, ?, ?)");
$insert->execute([$institution, $position, $positionname, $department, $natureofjob, $cametoknow]);
我建议使用准备好的语句,正如Sidney所说,在第16行中,您编写的是函子而不是函数