message box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • azura
    New Member
    • Jul 2008
    • 47

    message box

    hi sir.. i had a problem.... i want to make my page friendly user.... i had change my databse table with unique so that when user reclick the save button will came out warning sign... it work..! but how can i get the warning sign if there is duplicate entry, came out message box..?? if no duplicate entry it will save into database... so that means there had 2 message box... one if duplicate entry it will alert the user.. if no duplicate entry,will display message box that say data successfully save
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Show your code so far and what you've attempted.

    Comment

    • azura
      New Member
      • Jul 2008
      • 47

      #3
      [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>PBL Group Registration | Medic Assessment System</title>
      <link href="css/lgblue.css" rel="stylesheet " type="text/css" />
      <style type="text/css">
      <!--
      .style1 {font-family: Arial, Helvetica, sans-serif}
      .style23 {color: #000000}
      .style19 {
      font-size: 12px
      }
      .style2 {color: #FFFFFF}
      .style3 {color: #333333; }
      #form1 { background-color: #FFFFFF;
      }
      .style24 {color: #000000; font-weight: bold; }
      .style25 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
      .style27 {font-size: 12px; font-weight: bold; }
      body {
      background-color: #FFFFFF;
      }
      .style28 { font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      font-weight: bold;
      }
      -->
      </style>
      <script type="text/javascript">
      <!--
      function MM_popupMsg(msg ) { //v1.0
      alert(msg);
      }
      function MM_setTextOfTex tfield(objId,x, newText) { //v9.0
      with (document){ if (getElementById ){
      var obj = getElementById( objId);} if (obj) obj.value = newText;
      }
      }

      function MM_jumpMenu(tar g,selObj,restor e){ //v3.0
      eval(targ+".loc ation='"+selObj .options[selObj.selected Index].value+"'");
      if (restore) selObj.selected Index=0;
      }
      //-->
      </script>
      </head>
      <body>
      <form name="form1" method="post" action="" >
      <div align="left" class="style28" >
      <table width="500" border="1" align="center">
      <tr>
      <td height="33" colspan="4"><di v align="center" class="style24" >Medic Assessment System</div></td>
      </tr>
      <tr>
      <td height="26" colspan="4"><di v align="center" class="style25 style23"> Group Registration</div></td>
      </tr>
      <tr>
      <td width="99" class="style1"> <div align="right" class="style3 style19"><stron g>Year </strong>:</div></td>
      <td width="128" class="style1">
      <div align="left">
      <select name="value" id="year" onChange="MM_ju mpMenu('parent' ,this,0)">
      <option value="#">Pleas e select</option>
      <option value="?value=1 block 1&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='1 block 1'){echo"select ed=\"selected\" ";} ?>>1 block 1</option>
      <option value="?value=1 block 2&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='1 block 2'){echo"select ed=\"selected\" ";} ?>>1 block 2</option>
      <option value="?value=1 block 3&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='1 block 3'){echo"select ed=\"selected\" ";} ?>>1 block 3</option>
      <option value="?value=1 block 4&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='1 block 4'){echo"select ed=\"selected\" ";} ?>>1 block 4</option>
      <option value=" "> </option>
      <option value="?value=2 block 1&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='2 block 1'){echo"select ed=\"selected\" ";} ?>>2 block 1</option>
      <option value="?value=2 block 2&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='2 block 2'){echo"select ed=\"selected\" ";} ?>>2 block 2</option>
      <option value="?value=2 block 3&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='2 block 3'){echo"select ed=\"selected\" ";} ?>>2 block 3</option>
      <option value="?value=2 block 4&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='2 block 4'){echo"select ed=\"selected\" ";} ?>>2 block 4</option>
      <option value=" "> </option>
      <option value="?value=3 block 1&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='3 block 1'){echo"select ed=\"selected\" ";} ?>>3 block 1</option>
      <option value="?value=3 block 2&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='3 block 2'){echo"select ed=\"selected\" ";} ?>>3 block 2</option>
      <option value="?value=3 block 3&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='3 block 3'){echo"select ed=\"selected\" ";} ?>>3 block 3</option>
      <option value="?value=3 block 4&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='3 block 4'){echo"select ed=\"selected\" ";} ?>>3 block 4</option>
      <option value=" "> </option>
      <option value="?value=4 block 1&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='4 block 1'){echo"select ed=\"selected\" ";} ?>>4 block 1</option>
      <option value="?value=4 block 2&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='4 block 2'){echo"select ed=\"selected\" ";} ?>>4 block 2</option>
      <option value="?value=4 block 3&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='4 block 3'){echo"select ed=\"selected\" ";} ?>>4 block 3</option>
      <option value="?value=4 block 4&group=<? echo $_GET['group'] ?>" <?php if($_GET['value']=='4 block 4'){echo"select ed=\"selected\" ";} ?>>4 block 4</option>
      </select>
      </div></td>
      <td width="89" class="style1"> <div align="right" class="style3"> <span class="style27" >Session </span>:</div></td>
      <td width="156" class="style1"> <div align="left" class="style3">
      <label>
      <input name="sessi" type="text" id="sessi" size="15" maxlength="15" value="2008/2009"/>
      </label>
      </div></td>
      </tr>
      <tr>
      <td class="style1"> <div align="right" class="style3"> <span class="style27" >PBL Group</span> :</div></td>
      <td class="style1"> <div align="left" class="style3">
      <label>
      <select name="group" size="1" id="group" onChange="MM_ju mpMenu('parent' ,this,0)">
      <option value="#">Pleas e select</option>
      <option value="?value=< ? echo $_GET['value']?>&group=1" <?php if($_GET['group']=='1'){echo "selected=\"sel ected\"";} ?>>1</option>
      <option value="?value=< ? echo $_GET['value']?>&group=2" <?php if($_GET['group']=='2'){echo "selected=\"sel ected\"";} ?>>2</option>
      <option value="?value=< ? echo $_GET['value']?>&group=3" <?php if($_GET['group']=='3'){echo "selected=\"sel ected\"";} ?>>3</option>
      <option value="?value=< ? echo $_GET['value']?>&group=4" <?php if($_GET['group']=='4'){echo "selected=\"sel ected\"";} ?>>4</option>
      <option value="?value=< ? echo $_GET['value']?>&group=5" <?php if($_GET['group']=='5'){echo "selected=\"sel ected\"";} ?>>5</option>
      <option value="?value=< ? echo $_GET['value']?>&group=6" <?php if($_GET['group']=='6'){echo "selected=\"sel ected\"";} ?>>6</option>
      <option value="?value=< ? echo $_GET['value']?>&group=7" <?php if($_GET['group']=='7'){echo "selected=\"sel ected\"";} ?>>7</option>
      <option value="?value=< ? echo $_GET['value']?>&group=8" <?php if($_GET['group']=='8'){echo "selected=\"sel ected\"";} ?>>8</option>
      <option value="?value=< ? echo $_GET['value']?>&group=9" <?php if($_GET['group']=='9'){echo "selected=\"sel ected\"";} ?>>9</option>
      <option value="?value=< ? echo $_GET['value']?>&group=10" <?php if($_GET['group']=='10'){echo "selected=\"sel ected\"";} ?>>10</option>
      <option value="?value=< ? echo $_GET['value']?>&group=11" <?php if($_GET['group']=='11'){echo "selected=\"sel ected\"";} ?>>11</option>
      <option value="?value=< ? echo $_GET['value']?>&group=12" <?php if($_GET['group']=='12'){echo "selected=\"sel ected\"";} ?>>12</option>
      </select>
      </label>
      </div></td>
      <td class="style1"> <div align="right">< span class="style3"> </span></div></td>
      <td class="style1"> <div align="left"><s pan class="style3"> </span></div></td>
      </tr>
      </table>

      <div align="center"> </div>
      <div align="center"> </div>
      <div align="left"></div>
      <div align="left">
      <p>&nbsp;</p>
      <table width="416" height="70" border="1" align="center">
      <tr>
      <td width="87" height="33"><sp an class="style23" ><strong>Matr ic No</strong></span> </td>
      <td width="7"><div align="center"> :</div></td>
      <td width="300"><in put name="matric" type="text" class="style28" id="matric" value="<?php echo $row_viewer['matric_no']; ?>" size="15" maxlength="15" /></td>
      </tr>
      <tr>
      <td height="29" bgcolor="#FFFFF F"><span class="style23" ><strong>Name </strong></span></td>
      <td><div align="center"> :</div></td>
      <td><input name="name" type="text" class="style28" id="name" value="<?php echo $row_viewer['name']; ?>" size="50" maxlength="50"/></td>

      </tr>
      </table>
      </div>
      </div>
      <p>&nbsp;</p>
      <div align="left">
      <input type="hidden" name="MM_insert " value="form1" />
      </div>
      <p>
      <form action="" method="post" name="form3">
      <blockquote>
      <blockquote>
      <blockquote>
      <p align="center">
      <input name="saved" type="submit" class="style28" id="saved" value="Save" onclick="alert( 'duplicate entry!'),return confirm('succes sfully saved')"/>
      <input name="reset" type="reset" class="style28" id="reset" value="Reset" />
      </p>
      </blockquote>
      </blockquote>
      </blockquote>
      </form>
      </p>
      <p>&nbsp;</p>
      </form>
      <form name="form2" method="post" action="">
      <tr>
      <td height="307" bordercolor="#0 00000" bgcolor="#00000 0" border="0"><p>& nbsp;</p>
      <p>&nbsp;</p>
      <table width="696" height="60" border="1" align="center" bordercolor="#0 00000">
      <tr>
      <td width="92" height="28" class="style3"> <div align="center" class="style28" ><strong>Matric _No</strong></div></td>
      <td width="216" class="style3"> <div align="center" class="style28" ><strong>Name </strong></div></td>
      <td width="71" class="style3"> <div align="center" class="style28" ><strong>Sess i</strong></div></td>
      <td width="75" class="style3"> <div align="center" class="style28" ><strong>Year </strong></div></td>
      <td width="67" class="style3"> <div align="center" class="style28" ><strong>Grou p</strong></div></td>
      <td width="66" class="style3"> <div align="center" class="style28" ><strong> Status </strong></div></td>
      <td width="63" class="style3"> <div align="center" class="style28" ><strong>Delete </strong></div></td>
      </tr>

      <?php do { ?>
      <tr>
      <td height="24" class="style3 style2 style4"><div align="left" class="style28" >
      <div align="center"> <?php echo $row_all['matric_no']; ?></div>
      </div></td>
      <td class="style3 style2 style4"><div align="left" class="style28" ><?php echo $row_all['name']; ?></div></td>
      <td class="style3 style2 style4"><div align="center" class="style28" ><?php echo $row_all['sessi']; ?></div></td>
      <td class="style3 style2 style4"><div align="center" class="style28" ><?php echo $row_all['year']; ?></div></td>
      <td class="style3 style2 style4"><div align="center" class="style28" ><?php echo $row_all['group']; ?></div></td>
      <td class="style3 style2 style4"><div align="center" class="style28" ><?php echo $row_all['status']; ?></div>
      <td class="style3 style2 style4"><div align="center">
      <input name="del_id[]" type="checkbox" class="style28" value="<?php echo $row_all['matric_no']; ?>" />
      </div>
      <?php } while ($row_all = mysql_fetch_ass oc($all)); ?></table>
      <p align="right" class="style2 style4">
      <label></label>
      </p>
      <div align="center"> </div>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <blockquote>
      <p align="left" class="style2 style4">


      <input name="button" type="submit" class="style28" id="button" onclick="return confirm('Are you sure you wish to delete the selected rows?')" value="Delete" />
      </p>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      </blockquote>
      <p align="center" class="style23" ><a href="menu_indi vidu.php">Back </a> | <a href="main.php" >Module Menu</a> | <a href="<?php echo $logoutAction ?>" onclick="MM_pop upMsg('You\'re successfully logout from this system...')">Lo gout</a></span></p>

      <p class="style2 style4">&nbsp;</p></td>
      <input type="hidden" name="value" id="value" value="<? echo $_GET['value'] ?>" />
      <input type="hidden" name="group" id="group" value="<? echo $_GET['group'] ?>" />
      </form>
      <embed name="CS1210559 072500" src="Windows Notify.wav" loop="false" autostart="fals e" hidden="true" width="0" height="0" enablejavascrip t="true"></embed>
      </body>
      </html>
      <?php
      if ((isset($_POST["name"])) && ($_POST["name"] == "")) {
      mysql_free_resu lt($viewer);

      mysql_free_resu lt($all);
      }
      ?>
      [/HTML]

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        To check for a duplicate entry, make an Ajax request to a PHP script which checks for duplicate entries. Call this function from the save button onclick (line 148 in your code).

        Comment

        • azura
          New Member
          • Jul 2008
          • 47

          #5
          got it!! thank you sir!!

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            You're welcome. Glad to help :)

            Comment

            Working...