Jump to content


Photo

displaying contents of selected tables


  • Please log in to reply
2 replies to this topic

#1 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 18 April 2006 - 07:55 PM

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

#2 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 April 2006 - 08:06 PM

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
(If something is wrong, please tell me. I'm learning this language. Thank you)

#3 debcous

debcous
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 18 April 2006 - 08:16 PM

[!--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) View Post[/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?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users