How to Add Message Box Using PHP

Submitted by jpy272727 on
I want to input a message box, "ID ALREADY REGISTERED". Please help.
  1. <?
  2. include("cn.php");
  3. $message= NULL;
  4.  
  5. $ID = $_POST['ID'];
  6. $Fname = $_POST['Fname'];
  7. $Mname = $_POST['Mname'];
  8. $Lname = $_POST['Lname'];
  9. $Address = $_POST['Address'];
  10. $Gender = $_POST['Gender'];
  11. if ($Gender == 0) {
  12.         $Gender2 = "Male";
  13. }else{
  14.         $Gender2 = "Female";
  15. }
  16. $Username = $_POST['Username'];
  17.  
  18. $Password1 = md5($_POST['Password1']);
  19. $Password2 = md5($_POST['Password2']);
  20. $Type = $_POST['Type'];
  21. $type1="Student";
  22. if ($Type == $type1) {
  23.         $Pending = "0";
  24. }
  25.  
  26.  
  27. $ASQL1 = "SELECT * FROM tbl_account WHERE Username='".$Username."' ";
  28. $ARS1 = mysql_query($ASQL1);
  29. $ANum1 = mysql_num_rows($ARS1);
  30. if ($ANum1 == 1) {
  31.         header("location: register3.php?Err=5");
  32. } else {
  33. $ASQL = "SELECT * FROM tbl_account WHERE ID='".$ID."' ";
  34. $ARS = mysql_query($ASQL);
  35. $ANum = mysql_num_rows($ARS);
  36. if ($ANum == 1) {
  37.         header("location: register3.php?Err=5");               
  38. } else {
  39. if (($ID != "") AND ($Fname != "") AND ($Mname != "") AND ($Lname != "") AND ($Address != "") AND ($Gender != "") AND ($Username != "") AND ($Password1 != "") AND ($Password2 != "")) {
  40.         if ($Password1 != $Password2) {
  41.                 header("location: register3.php?Err=5");
  42.         } else {
  43.  
  44.  
  45.         $SQL = "INSERT into tbl_account (ID, Username, Password, Type, Pending) VALUES ('$ID', '$Username', '$Password1', '$Type', '$Pending')";
  46.         $RS = mysql_query($SQL);
  47.  
  48.         $SQL2 = "INSERT into tbl_profile (ID, Fname, Mname, Lname, Address, Gender,Type) VALUES ('$ID', '$Fname', '$Mname', '$Lname', '$Address', '$Gender2','$Type')";
  49.         $RS2 = mysql_query($SQL2);
  50.  
  51.         $SQL3 = "INSERT into tbl_confirm (ID, Fname, Lname,Type) VALUES ('$ID', '$Fname', '$Lname', '$Type')";
  52.         $RS3 = mysql_query($SQL3);
  53.        
  54.         header("location: log2.php");
  55.         }
  56. } else {
  57.         header("location: log2.php");  
  58. }
  59.  
  60. }
  61. }
  62. ?>
  63.  
  64.  
  65. here is my code,
  66. $ASQL = "SELECT * FROM tbl_account WHERE ID='".$ID."' ";
  67. $ARS = mysql_query($ASQL);
  68. $ANum = mysql_num_rows($ARS);
  69. if ($ANum == 1) {
  70.         header("location: register3.php?Err=5");               
  71. } else {