Jump to content

Archived

This topic is now archived and is closed to further replies.

debcous

displaying contents of selected tables

Recommended Posts

<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?

Share this post


Link to post
Share on other sites
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 data

so, 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

Share this post


Link to post
Share on other sites
[!--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 data

so, 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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.