我不知道所有这些代码出了什么问题。我正在尝试编辑/更新提交时的HTML表单。让我简要介绍一下;
- 我们有一个搜索html,我们已成功搜索。 [search.php中]
- 之后,基于search.php,我们正在查看数据库的结果,这太过成功[view.php]
我不知道自己哪里出错了。
<?php
//All database connection is done successfull and sql query is too fine for me.
$result=mysql_query($sql) or die(mysql_error());
echo "in result";
while($row=mysql_fetch_array($result))
{
$viewrecruiter0=$row['recruiter_did'];
$viewrecruiter1=$row['recruiter_name'];
$viewrecruiter2=$row['recruiter_mobile'];
}
?>
<form name="form4" method="POST" action='viewrecruiter.php?var=<?php echo urlencode($viewrecruiter0);?>'>
<div class="form-group">
<div class="row">
<div class="col-lg-2">
<label for="Recruiter Name">Recruiter code :</label>
</div>
<div class="col-lg-2">
<?php echo $viewrecruiter0; ?>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-2">
<label for="Recruiter Name">Recruiter Name :</label>
</div>
<div class="col-lg-2 f1">
<?php echo $viewrecruiter1; ?>
</div>
<div class="f2">
<input type="text" class="form-control" id="recruiter_v_by_name" name="recruiter_v_by_name" value="<?php echo $viewrecruiter1;?>">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-2">
<label for="Recruiter Name">Recruiter Mail :</label>
</div>
<div class="col-lg-2 f1">
<?php echo $viewrecruiter2; ?>
</div>
<div class="f2">
<input type="text" class="form-control" id="recruiter_v_by_mail" name="recruiter_v_by_mail" value="<?php echo $viewrecruiter2;?>">
</div>
</div>
</div>
<div class="btn-group">
<input type="button" id="recruiter_v_btn1" name="recruiter_v_btn1" value="Edit" class="btn2 btn-primary show" style="margin-left:316px">
</div>
<?php
if (isset($_GET['var']))
{
$id1=$_GET['var'];
echo $id1;
}
?>
<input type="submit" id="recruiter_v_btn2" name="recruiter_v_btn2" value="Update" class="btn2 btn-primary" style="margin-top:-1px">
<?php
if(isset($_POST['recruiter_v_btn2']))
{
$query1="UPDATE recruiter,recruiter_details SET recruiter.recruiter_name='".$_POST['recruiter_v_by_name']."'".",recruiter.recruiter_mobile='".$_POST['recruiter_v_by_mail']."'"." where recruiter.recruiter_num=recruiter_details.recruiter_did AND recruiter.recruiter_num=".$id1;
mysql_query($query1) or die(mysql_error());
}
?>
</form>
我们通过查询字符串在同一页面上传递招聘人员代码。 我想点击&#34;更新&#34;按钮页面正在刷新并且没有获得搜索查询结果,这就是它显示&#34;查询为空的原因&#34;。