shebbycs Posted April 10, 2013 Share Posted April 10, 2013 //countercashadminlocation.php <?php session_start(); if (empty($_SESSION['is_logged_in'])) { header("Location:login.php"); die(); // just to make sure no scripts execute } ?> <?php mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("kime") or die(mysql_error()); $a=$_SESSION['branchcodename']; if (isset($_POST["submit"])) { $place = $_POST['tempat']; $_SESSION['tempat']=$place; $b= $_SESSION['tempat']; $sql1 = mysql_query("SELECT *,DATE_FORMAT(Form_Date, '%d/%m/%Y %H:%i %p') AS Form_Date FROM counter_cash WHERE Branch_Codename='$place' ORDER BY Form_Date") or die(mysql_error()); $sql2 = mysql_query("SELECT * FROM counter_cash WHERE Branch_Codename='$place'") or die(mysql_error()); echo "<body bgcolor='#F5D16A'>"; echo "<center><img src ='OK.gif'></center><br>"; echo "<center><h2>COUNTER CASH CHECKING REPORT</h2>"; echo "<table><tr><td><h3>LOCATION</h3></td><td><h3>:</h3></td><td><h3>".$place."</h3></td></tr></table></center>"; echo "<center><table border = '1'>"; echo "<tr><th rowspan='2'>ID</th><th rowspan='2'>DATE & TIME</th><th rowspan='2'>CASHIER NAME</th><th colspan='3'>COUNTER CASH</th><th colspan='3'>PETTY CASH</th><th rowspan='2'>SIGN</th><th rowspan='2'>HANDOVER TO (NAME)</th><th rowspan='2'>SIGN</th><th rowspan='2'>CHECK BY </th></tr>"; echo "<tr><th>AMOUNT</th><th>SHORTAGE</th><th>EXCESS</th><th>AMOUNT</th><th>SHORTAGE</th><th>REMARK</th></tr>"; while($report = mysql_fetch_array($sql1)) { echo "<tr align='center'><td>".$report['ID']."</td>"; echo "<td>".$report['Form_Date']."</td> "; echo "<td>".$report['Cashier_Name']."</td> "; echo "<td>RM ".$report['Counter_Amount']."</td> "; echo "<td>RM ".$report['Counter_Shortage']."</td> "; echo "<td>RM ".$report['Counter_Excess']."</td> "; echo "<td>RM ".$report['Petty_Amount']."</td> "; echo "<td>RM ".$report['Petty_Shortage']."</td> "; echo "<td>".$report['Petty_Remark']."</td> "; echo "<td>".$report['Cashier_Sign']."</td> "; echo "<td>".$report['Handover_Name']."</td> "; echo "<td>".$report['Handover_Sign']."</td> "; echo "<td>".$report['Check_By']."</td> "; } echo"</table></center><br>"; echo"<center><form name='editcheckby' method='post' action='countercashadmineditcheckby.php'>"; echo "<table><tr><td><b>CHOOSE ID TO CHECK BY</b></td></tr><tr><td><center><select name = 'cuba'>"; while($checkby = mysql_fetch_array($sql2)) { echo "<option value ='".$checkby['ID']."'>".$checkby['ID']."</option>"; } echo "</select></center></td></tr>"; echo "<tr><td><center><input type='submit' name='submit' value='Check'></center></td></tr></table></form>"; echo "<center><h3><a href='adminselect.php'>BACK</a> <a href='logout.php'>LOG OUT</a></h3></center>"; } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function a() { var x = document.select.branchcodename.value; if(x=="") { alert("Please choose branch location"); return false; } } </script> </head> <body bgcolor="#F5D16A"> <center> <img src="OK.gif" /> <table border="0" align="center"> <form name="select" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return a()"> <tr><td><center><h1>CHOOSE COUNTER CASH CHECKING REPORT LOCATION</h1></center></td></tr> <tr><td><center>Branch Codename:<select name="tempat"> <option value="OK01">OK</option> <option value="TK02">TK</option> </select></center></td></tr> <tr><td><center><input type="submit" name="submit" value="Submit"></center></td></tr> </form> </table> </center> </body> </html> <?php } // $sql3 = mysql_query("UPDATE counter_cash SET Check_By ='$a' WHERE Check_By ='' "); // $sql4 = mysql_query("UPDATE counter_cash2 SET Check_By ='$a' WHERE Check_By ='' "); ?> //countercashadmineditcheckby.php <?php session_start(); if (empty($_SESSION['is_logged_in'])) { header("Location:login.php"); die(); // just to make sure no scripts execute } ?> <?php mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("kime") or die(mysql_error()); $a=$_SESSION['branchcodename']; $b=$_SESSION['tempat']; if (isset($_POST["submit"])) { $b=$_SESSION['tempat']; $checkby=$_POST['cuba']; $sql1 = mysql_query("UPDATE counter_cash SET Check_By = '$a' WHERE ID = '$checkby'") or die(mysql_error()); $_SESSION['is_logged_in'] = 1; if($_SESSION['is_logged_in'] == 1) { header("Location: countercashadminviewedit.php"); } } ?> //countercashadminviewedit.php <?php session_start(); if (empty($_SESSION['is_logged_in'])) { header("Location:login.php"); die(); // just to make sure no scripts execute } ?> <?php mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("kime") or die(mysql_error()); $a=$_SESSION['branchcodename']; $b=$_SESSION['tempat']; $sql1 = mysql_query("SELECT *,DATE_FORMAT(Form_Date, '%d/%m/%Y %l:%i %p') AS Form_Date FROM counter_cash WHERE Branch_Codename='$b' ORDER BY Form_Date") or die(mysql_error()); $sql2 = mysql_query("SELECT * FROM counter_cash WHERE Branch_Codename='$b'") or die(mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body bgcolor='#F5D16A'> <center><img src ='OK.gif'></center><br> <center><h2>COUNTER CASH CHECKING REPORT</h2><table><tr><td><h3>LOCATION</h3></td><td><h3>:</h3></td><td><h3><?php echo $b; ?></h3></td></tr></table></center> <center><table border = '1'> <tr><th rowspan='2'>ID</th><th rowspan='2'>DATE & TIME</th><th rowspan='2'>CASHIER NAME</th><th colspan='3'>COUNTER CASH</th><th colspan='3'>PETTY CASH</th><th rowspan='2'>SIGN</th><th rowspan='2'>HANDOVER TO (NAME)</th><th rowspan='2'>SIGN</th><th rowspan='2'>CHECK BY</th></tr><tr><th>AMOUNT</th><th>SHORTAGE</th><th>EXCESS</th><th>AMOUNT</th><th>SHORTAGE</th><th>REMARK</th></tr><?php while($report = mysql_fetch_array($sql1)) { ?><tr align='center'><td><?php echo $report['ID'];?></td><td><?php echo $report['Form_Date'];?></td><td><?php echo $report['Cashier_Name'];?></td><td>RM <?php echo $report['Counter_Amount'];?></td><td>RM <?php echo $report['Counter_Shortage'];?></td><td>RM <?php echo $report['Counter_Excess'];?></td><td>RM <?php echo $report['Petty_Amount'];?></td><td><?php echo $report['Petty_Shortage'];?></td><td><?php echo $report['Petty_Remark'];?></td><td><?php echo $report['Cashier_Sign'];?></td><td><?php echo $report['Handover_Name'];?></td><td><?php echo $report['Handover_Sign'];?></td><td><?php echo $report['Check_By'];?></td></tr><?php } ?> </table></center><br /><center><form name='editcheckby' method='post' action='countercashadmineditcheckby.php'><table><tr><td><b>CHOOSE ID TO CHECK BY</b></td></tr><tr><td><center><select name = 'cuba'><?php while($checkby = mysql_fetch_array($sql2)) { ?><option value = <?php echo $checkby['ID'];?>><?php echo $checkby['ID'];?></option><?php } ?></select></center></td></tr> <tr><td><center><input type='submit' name='submit' value='Check'></center></td></tr></table></form> <center><h3><a href='adminselect.php'>BACK</a> <a href='logout.php'>LOG OUT</a></h3></center> </body> </html> This 3 pages is just to make the "Check_By" field contained data but my problem was once I updated "Check_By" field according to the ID, I want the dropdownlist to contain ID where the Check By was not filled with data because now it still listing all the ID and not listing ID where check_by still not being filled That ID dropdownlist code was countercashadminlocation.php echo "<table><tr><td><b>CHOOSE ID TO CHECK BY</b></td></tr><tr><td><center><select name = 'cuba'>"; while($checkby = mysql_fetch_array($sql2)) { echo "<option value ='".$checkby['ID']."'>".$checkby['ID']."</option>"; } echo "</select></center></td></tr>"; echo "<tr><td><center><input type='submit' name='submit' value='Check'></center></td></tr></table></form>"; Any suggestion or solution Link to comment https://forums.phpfreaks.com/topic/276765-the-option-is-not-in-dropdownlist-if-the-check-by-contained-data/ Share on other sites More sharing options...
shebbycs Posted April 11, 2013 Author Share Posted April 11, 2013 Problem solved I found the error and correct it Link to comment https://forums.phpfreaks.com/topic/276765-the-option-is-not-in-dropdownlist-if-the-check-by-contained-data/#findComment-1424075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.