我是PHP的新手。当我尝试更新或修改我的表单时,它没有在phpmyadmin数据库表中更新。我正在使用AJAX,jQuery和PHP。我被困在这里,所以任何人都可以指导我如何解决这个问题。提前致谢。以下是代码人员。
update_details.php
<div class="panel-body">
<?php
$q1="SELECT * FROM `plantation_journal_basic_details` WHERE `plantation_journal_no`='$plantation_journal_no' ";
$r1=mysqli_query($con,$q1);
$ro1=mysqli_fetch_array($r1);
?>
<form id="form1" action="update_details.php?id='<?php echo $plantation_journal_no; ?>'" name="form1" method="post">
<div class="row">
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>Basic Details:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Scheme:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['scheme']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Year:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['year']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Range:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['ranges']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Beat:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['beat']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">JFMC:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['jfmc']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Panchayat Samity:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['panchayat_samity']; ?></label><br><br>
<label style="font-weight:300;font-size: 15px">Gram Panchayat:</label>
<label align="left" style="width:50%;margin-left: 10px;font-weight:300;font-size: 15px"><?php echo $ro1['gram_panchayat']; ?></label><br><br>
</div>
</div>
</div>
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>GPS Coordinates:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Latitude:</label>
<input type="text" name="latitude_degree" value="<?php echo $ro1['latitude_degree']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">°</label>
<input type="text" name="latitude_minute" value="<?php echo $ro1['latitude_minute']; ?>" style="width:10%;height: 30px; margin-left: 10px; padding: 0 0 0 1px; border-radius: 5px;">
<label style="font-weight:300;font-size: 15px">'</label>
<input type="text" name="latitude_second" value="<?php echo $ro1['latitude_second']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">"</label><br>
<label style="font-weight:300;font-size: 15px">Longitude:</label>
<input type="text" name="longitude_degree" value="<?php echo $ro1['longitude_degree']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">°</label>
<input type="text" name="longitude_minute" value="<?php echo $ro1['longitude_minute']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">'</label>
<input type="text" name="longitude_second" value="<?php echo $ro1['longitude_second']; ?>" style="width:10%;height: 30px; margin-left: 10px; border-radius: 5px; padding: 0 0 0 1px;">
<label style="font-weight:300;font-size: 15px">"</label><br>
</div>
<h4 style="font-size: 16px;"><b>Boundary:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">North:</label>
<input type="text" name="north" value="<?php echo $ro1['north']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">East:</label>
<input type="text" name="east" value="<?php echo $ro1['east']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">West:</label>
<input type="text" name="west" value="<?php echo $ro1['west']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">South:</label>
<input type="text" name="south" value="<?php echo $ro1['south']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
</div>
<div class="col-sm-4">
<h4 style="font-size: 16px;"><b>Surveyed By:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Full Name:</label>
<input type="text" name="full_name_s" value="<?php echo $ro1['ful_name_s']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Designation:</label>
<input type="text" name="designation_s" value="<?php echo $ro1['designation_s']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
<h4 style="font-size: 16px;"><b>Checked By:</b></h4><br>
<div align="right" style="padding-right: 10px;" >
<label style="font-weight:300;font-size: 15px">Full Name:</label>
<input type="text" name="full_name_c" value="<?php echo $ro1['full_name_c']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
<label style="font-weight:300;font-size: 15px">Designation:</label>
<input type="text" name="designation_c" value="<?php echo $ro1['designation_c']; ?>" style="width:50%;height: 30px; margin-left: 10px; border-radius: 5px;"><br>
</div>
</div>
</div>
<br>
<div align="right">
<input class="btn btn-info btn-submit8" type="submit" name="submit_1" value="Add" onclick="move1()">
</div>
</form>
<?php
if(isset($_POST['latitude_degree'])){
$latitude_degree=$_POST['latitude_degree'];
$latitude_minute=$_POST['latitude_minute'];
$latitude_second=$_POST['latitude_second'];
$longitude_degree=$_POST['longitude_degree'];
$longitude_minute=$_POST['longitude_minute'];
$longitude_second=$_POST['longitude_second'];
$north=$_POST['north'];
$east=$_POST['east'];
$west=$_POST['west'];
$south=$_POST['south'];
$full_name_s=$_POST['full_name_s'];
$designation_s=$_POST['designation_s'];
$full_name_c=$_POST['full_name_c'];
$designation_c=$_POST['designation_c'];
$sql="UPDATE `plantation_journal_basic_details` SET `latitude_degree`='$latitude_degree',`latitude_minute`='$latitude_minute',`latitude_second`='$latitude_second',`longitude_degree`='$longitude_degree',`longitude_minute`='$longitude_minute',`longitude_second`='$longitude_second',`north`='$north',`east`='$east',`west`='$west',`south`='$south',`ful_name_s`='$full_name_s',`designation_s`='$designation_s',`full_name_c`='$full_name_c',`designation_c`='$designation_c' WHERE `plantation_journal_no`='$plantation_journal_no'";
$result=mysqli_query($con,$sql);
}
?>
答案 0 :(得分:0)
提交所有输入值的更简单方法是:
$('#form').ajaxForm({
/*....*/
});
你试过吗?