gnawz Posted July 26, 2007 Share Posted July 26, 2007 these are my files reports.php $Report = $_GET['report']; switch ($Report) { case 'add' : addfunction(); break; case 'delete' : deletefunction(); break; case 'update' : updatefunction(); break; } the other file with my select... checkrpt.php <form name="frmUtils" method="post" action=""> <select name="Do" id ="Do"onChange="SwapReport();"> <option value="0">Select view</option> <option value="1">Add</option> <option value="2">Update</option> <option value="2">Delete</option> </select> </form> <script type="text/javascript"> function SwapReport() { if (document.frmUtils.Do.selectedIndex == 1) { document.frmUtils.action = "reports.php?report=add"; } else if (document.frmUtils.Do.selectedIndex == 2) { document.frmUtils.action = "reports.php?report=update"; } else (document.frmUtils.Do.selectedIndex == 3) { document.frmUtils.action = "reports.php?report=delete"; } } </script> Help from here. It is not working yet. Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted July 26, 2007 Share Posted July 26, 2007 Check this out.. <? $Report = $_GET['report']; switch ($Report){ case 'add' : addfunction(); break; case 'delete' : deletefunction(); break; case 'update' : updatefunction(); break; } ?> the other file with my select... checkrpt.php <form name="frmUtils" method="post" action=""> <select name="Do" id ="Do"onChange="SwapReport();"> <option value="0">Select view</option> <option value="1">Add</option> <option value="2">Update</option> <option value="2">Delete</option> </select> </form> <script type="text/javascript"> function SwapReport(){ if (document.frmUtils.Do.selectedIndex == 1){ document.frmUtils.action = "reports.php?report=add"; } else if (document.frmUtils.Do.selectedIndex == 2){ document.frmUtils.action = "reports.php?report=update"; } else if(document.frmUtils.Do.selectedIndex == 3){ document.frmUtils.action = "reports.php?report=delete"; } else{ document.frmUtils.action = "reports.php?report=nofunction"; } } </script> Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted July 26, 2007 Share Posted July 26, 2007 try this small code <?php <form name="frmUtils" method="post" action=""> <select name="Do" id ="Do" onChange="SwapReport(this.value)"> <option value="reports.php?report=view">Select view</option> <option value="reports.php?report=add">Add</option> <option value="reports.php?report=upd">Update</option> <option value="reports.php?report=del">Delete</option> </select> </form> <script type="text/javascript"> function SwapReport(page){ location.href=page; } </script> ?> Quote Link to comment Share on other sites More sharing options...
gnawz Posted July 26, 2007 Author Share Posted July 26, 2007 Thanks alot. It works!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.