Hi ErnieAlex, yes your reply makes sense… I am still new to php and appreciate you going through it step by step.
I’ve added a check for the values before hand, I’ve pasted my full code as I was trying to shorten my post length but its getting complicated every time I update it;-
[php]
<?php include '../../includes/header.php';?>
<div id="wrapper">
<!-- Navigation -->
<?php include '../../includes/navigation.php';?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Projects</h1>
Back
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
DataTables Advanced Tables
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<?php
if (!empty($_GET['u'])){
echo 'not empty';
}else{
echo 'is not set or empty';
}
?>
<?php
include('../../includes/mysqli_connect.php');
if ( isset( $_GET['u'] ) && !empty( $_GET['u'] ) ):
if(isset($_POST['pro'])):
if(
$_POST['date'] !=null
&& $_POST['project'] !=null
&& $_POST['client'] !=null
&& $_POST['hot'] !=null
&& $_POST['cold'] !=null
&& $_POST['value'] !=null
&& $_POST['category'] !=null
&& $_POST['order_no'] !=null
&& $_POST['del'] !=null
&& $_POST['estimate'] !=null
&& $_POST['salesman'] !=null
&& $_POST['design'] !=null
&& $_POST['retention'] !=null
&& $_POST['payment'] !=null
&& $_POST['site_adr_1'] !=null
&& $_POST['site_contact']!=null
&& $_POST['execution'] !=null
&& $_POST['spec'] !=null
&& $_POST['cold_rolled'] !=null
&& $_POST['hd_bolts'] !=null
&& $_POST['site_fixings'] !=null
&& $_POST['bought_outs'] !=null
&& $_POST['mpi'] !=null
&& $_POST['butt'] !=null
&& $_POST['pressings'] !=null
&& $_POST['rollings'] !=null
&& $_POST['paint'] !=null
&& $_POST['treatment'] !=null
&& $_POST['identification'] !=null
&& $_POST['fi_steel'] !=null
&& $_POST['fi_fittings'] !=null
&& $_POST['notes'] !=null
&& $_POST['live'] !=null
&& $_POST['draughtsman'] !=null
&& $_POST['lifting_st'] !=null
&& $_POST['rwc_review'] !=null
&& $_POST['client_id'] !=null
&& $_POST['client_proj_no'] !=null
&& $_POST['dsn_codes'] !=null
&& $_POST['wps'] !=null
){
$stmt = $mysqli->prepare("UPDATE fms_tbl_projects set date = ?,project = ?,client = ?,hot = ?,cold = ?,value = ?,category = ?,order_no = ?,del = ?,estimate = ?,salesman = ?,design = ?,retention = ?,payment = ?,site_adr_1 = ?,site_Contact = ?,execution = ?,spec = ?,cold_rolled = ?,hd_bolts = ?,site_fixings = ?,bought_outs = ?,mpi = ?,butt = ?,pressings = ?,rollings = ?,paint = ?,treatment = ?,identification = ?,fi_steel = ?,fi_fittings = ?,notes = ?,live = ?,draughtsman = ?,lifting_st = ?,rwc_review = ?, client_id = ?, dsn_codes = ?, wps = ? WHERE client_proj_no = ?");
$stmt->bind_param('ssssssssssssssssssssssssssssssssssssssss', $date,$project,$client,$hot,$cold,$value,$category,$order_no,$del,$estimate,$salesman,$design,$retention,$payment,$site_adr_1,$site_Contact,$execution,$spec,$cold_rolled,$hd_bolts,$site_fixings,$bought_outs,$mpi,$butt,$pressings,$rollings,$paint,$treatment,$identification,$fi_steel,$fi_fittings,$notes,$live,$draughtsman,$lifting_st,$rwc_review, $client_id, $dsn_codes, $wps, $client_proj_no);
$date = $_POST['date'];
$project = $_POST['project'];
$client = $_POST['client'];
$hot = $_POST['hot'];
$cold = $_POST['cold'];
$value = $_POST['value'];
$category = $_POST['category'];
$order_no = $_POST['order_no'];
$del = $_POST['del'];
$estimate = $_POST['estimate'];
$salesman = $_POST['salesman'];
$design = $_POST['design'];
$retention = $_POST['retention'];
$payment = $_POST['payment'];
$site_adr_1 = $_POST['site_adr_1'];
$site_Contact = $_POST['site_contact'];
$execution = $_POST['execution'];
$spec = $_POST['spec'];
$cold_rolled = $_POST['cold_rolled'];
$hd_bolts = $_POST['hd_bolts'];
$site_fixings = $_POST['site_fixings'];
$bought_outs = $_POST['bought_outs'];
$mpi = $_POST['mpi'];
$butt = $_POST['butt'];
$pressings = $_POST['pressings'];
$rollings = $_POST['rollings'];
$paint = $_POST['paint'];
$treatment = $_POST['treatment'];
$identification = $_POST['identification'];
$fi_steel = $_POST['fi_steel'];
$fi_fittings = $_POST['fi_fittings'];
$notes = $_POST['notes'];
$live = $_POST['live'];
$draughtsman = $_POST['draughtsman'];
$lifting_st = $_POST['lifting_st'];
$rwc_review = $_POST['rwc_review'];
$client_id = $_POST['client_id'];
$client_proj_no = $_POST['client_proj_no'];
$dsn_Codes = $_POST['dsn_codes'];
$wps = $_POST['wps'];
if($stmt->execute()):
echo "";
else:
echo "";
endif;
endif;
$res = $mysqli->query("SELECT * FROM fms_tbl_projects WHERE client_proj_no=".$_GET['u']);
$row = $res->fetch_assoc();
?>
×Close
Failed! Please add more, if you want to sign out click
Home.
<?php
else:
?>
×Close
Failed! A total failure, please try again!!!.<?php echo $stmt->error; ?>
<?php
endif;
} else{
?>
×Close
Failed! The form cannot be empty, please complete and try again.
<?php
}
endif;
?>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<?php
endif;
include '../../includes/footer.php';?>
[/php]