How I want maintain what the user key in after alert box appear; window.alert('No rujukan tidak dijumpai'). Please help me. <?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <p class="title"><b>PENGESAHAN PENDAFTARAN</b></p> <div class="content"> <?php if(isset($_POST['seterusnya'])) { $template = $_POST['template']; $no_rujukan = $_POST['no_rujukan']; if($template == 'template_perlembagaan') { echo "<script language='Javascript'>navigate('semak.php')</script>"; exit(); } if($template == 'template_sendiri') { include('../config/conn_db.php'); $result = mysql_query("SELECT no_rujukan FROM semakan_kaunter WHERE no_rujukan = '$no_rujukan'") or die ("No Rujukan tidak jumpa"); $matched = mysql_fetch_array($result); if($matched){ echo "<script language='Javascript'>navigate('semak.php')</script>"; exit(); } else{ echo("<SCRIPT LANGUAGE='JavaScript'> window.alert('No rujukan tidak dijumpai') </SCRIPT>"); } } } ?> <form id="form1" name="form1" method="post" action=""> <table id="t1" width="356" border="0"> <tr> <td colspan="3"><strong>Pilihan Perlembagaan</strong></td> </tr> <tr> <td colspan="3"> <input type="radio" name="template" value="template_perlembagaan" /> Template Perlembagaan <br /> <input type="radio" name="template" value="template_sendiri" /> Perlembagaan Sendiri <br /></td> </tr> <tr> <td width="20"> </td> <td colspan="2">Nombor Rujukan Semakan: <input type="text" name="no_rujukan" id="textfield" /></td> </tr> <tr> <td> </td> <td width="127"> </td> <td width="198"> </td> </tr> <tr align="right"> <td> </td> <td> </td> <td><input type="submit" name="seterusnya" value="Seterusnya" /></td> </tr> <tr align="right"> <td> </td> <td> </td> <td><label></label></td> </tr> </table> <br/> </form> </div> </td> </tr> </table> </body> </html> PHP:
Hi.. HungryMinds. yes. it working. but after i click ok at alert box, the value that i key in at the radio button and text field missing. i want they still with the value i key in before. Can?
From the looks of this, the alert box should be popping up before you would normally get the chance the click on any radio buttons or fill in the text box. Since there seems to be no default values or selections for the inputs then there shouldn't be anything to save.