php - I want a alert box to come up when records are updated -
i have php file need check if variables not empty , update table.everything works fine except alert.
<?php $con=mysql_connect("localhost","root",""); mysql_select_db("sg",$con); error_reporting(0); $result1=mysql_query("select declarationno,declarantreferenceno sg_report declarationno='$dec' or declarantreferenceno='$dec'"); if(isset($_post['mytext'])){ $cn = $_post['mytext']; } if(isset($_post['mytext1'])){ $dec = $_post['mytext1']; } if(isset($_post['tb3'])){ $rem = $_post['tb3']; } want alert box come when records updated if( !empty($dec) && !empty($rem) ){ $result=mysql_query("update sg_report set creditnotestatus='$cn',remarks='$rem' declarationno='$dec' or declarantreferenceno='$dec'"); echo "<script type='text/javascript'>alert('updated successfully!');</script>"; }
i want alert box come if values not entered
if(empty($dec) || empty($rem) ) { echo "<script type='text/javascript'>alert(\"please enter values\");window.location=\"view3.php\";</script>"; } ?>
try one
if(trim($_post['mytext'])!=''&&trim($_post['mytext1'])!=''&&trim($_post['tb3'])!='') { $result=mysql_query("update sg_report set creditnotestatus='$cn',remarks='$rem' declarationno='$dec' or declarantreferenceno='$dec'"); if($result) { echo "<script type='text/javascript'>alert('updated successfully!');</script>"; } } else { echo "<script type='text/javascript'>alert(\"please enter values\");window.location=\"view3.php\";</script>"; }
Comments
Post a Comment