So, im a little new to php and i need to send a table name to another php file this is the code i already have:
<form action="clases.php" method="GET">
<?php
$result= mysql_query('SHOW TABLES', $conn) or die ('cannot show tables');
while($tablename = mysql_fetch_array($result)){
$a=0;
$table = $tablename[$a];
echo '<table cellpadding="0" cellspacing="0" class="db-table">';
echo '<tr>';
echo '<td>',$table,'<input type="hidden" name="Class" value="' . $table . '" />';
echo '</td>';
echo "<td><input type='submit' name='Entrar' value='Enter'></td>";
echo "<td><input type='submit' name='Eliminar' value='Delete'></td>";
echo '</tr>';
echo '</table><br />';
++$a;
}
?>
</form>
Right now i just need the Enter button working, when i submit it i should send to another php file with just:
<?php $classname = $_GET['Class']; echo $classname; ?>
But it always gives me the last table i created, so if a have 3 tables created
- Table A
- Table B
- Table C
the $classname always shows "Table C".
Sorry about the english, its not my first lenguaje.