debcous Posted April 18, 2006 Share Posted April 18, 2006 <form action="viewtables.php" method="post"><center><table><tr><td><font color="#0099CC"><b>Select Table:</b></font></td></tr><tr><td><label> <select name="table" id="table"> <option value="auth_users">Members table</option> <option value="admin">Admin Details</option> <option value="bus">Bus Entries</option> <option value="train">Train Entries</option> <option value="operator">Operators</option> </select> </label> </table></center><center><input type="submit" name="submit" value="SUBMIT"/> </p></center><input type="hidden" name="submitted" value="TRUE"/></form></font><?php if(isset($_POST['submitted'])){ include "db.php"; $t = trim($_POST['table']); $query = "SELECT * FROM auth_users"; $result = @mysql_query($query, $conn); if($result){ echo'Hi...in the above code i am trying to allow the administrator to select a table from the database called "getmeth_login". The above code only displays the contents of the "auth_users" table. Can anyone show me how to display the contents of any of the tables selected in the drop down menu please? Quote Link to comment https://forums.phpfreaks.com/topic/7762-displaying-contents-of-selected-tables/ Share on other sites More sharing options...
Darkness Soul Posted April 18, 2006 Share Posted April 18, 2006 If I understood it right, you want to allow the admin select one of the table listed on the drop, click submit and view the table data.. right?De option value is the right name of the table?? and want to show all tables in one page?I think its easyer to you make one page for each table view, and in that page, do a SELECT * FROM.. listing all dataso, your form call a page lice check.php, in this one, the $_POST will redirect you to the page you want..Any better idea?^^ D.Soul Quote Link to comment https://forums.phpfreaks.com/topic/7762-displaying-contents-of-selected-tables/#findComment-28312 Share on other sites More sharing options...
debcous Posted April 18, 2006 Author Share Posted April 18, 2006 [!--quoteo(post=366154:date=Apr 18 2006, 03:06 PM:name=Darkness Soul)--][div class=\'quotetop\']QUOTE(Darkness Soul @ Apr 18 2006, 03:06 PM) [snapback]366154[/snapback][/div][div class=\'quotemain\'][!--quotec--]If I understood it right, you want to allow the admin select one of the table listed on the drop, click submit and view the table data.. right?De option value is the right name of the table?? and want to show all tables in one page?I think its easyer to you make one page for each table view, and in that page, do a SELECT * FROM.. listing all dataso, your form call a page lice check.php, in this one, the $_POST will redirect you to the page you want..Any better idea?^^ D.Soul[/quote]Do i need to use an if statement then to redirect it to the page i want? so if the admin chooses to view the contents of the bus table it will redirect them to a page that displays just the contents of the bus table? Quote Link to comment https://forums.phpfreaks.com/topic/7762-displaying-contents-of-selected-tables/#findComment-28321 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.