JAVASCRIPT: OK button proceed to another .php form -
i have basic javascript code saving entry.
scenario:
i have 2 forms, first form,[view_netbldg.php], data entry when user click "add" button proceed next form [save_netbldg.php]. in save_netbldg.php form there if else condition code know first if variable of $bldgname or $netname empty. okay, concern when code detect either of 2 variables empty code below i'm using executed.
here's code:
if($bldgname == "" || $netname == "") { echo "<script type='text/javascript'>\n"; echo "alert('please complete fields building name or network name');\n"; echo "</script>"; header("location:view_netbdlg.php"); }
*the result of program is, not displaying alert instead jump header
the correct way is, if $bldgname == "" || $netname == "" == true** alert display , when user click ok button proceed next form "view_netbdlg.php". don't need confirmation message here because error message that.
advance thank you.
you confusing php javascript, can solve by
if($bldgname == "" || $netname == "") { echo "<script type='text/javascript'>\n"; echo "alert('please complete fields building name or network name');\n"; echo "window.location='view_netbdlg.php';\n"; echo "</script>"; }
Comments
Post a Comment