html - PHP when sending data (table name) via a Submit button always shows the last table created -


so, im little new php , need send table name php file code 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 need enter button working, when submit should send php file just:

<?php $classname = $_get['class']; echo $classname; ?> 

but gives me last table created, if have 3 tables created

  • table a
  • table b
  • table c

the $classname shows "table c".

sorry english, not first lenguaje.

it because code executed in loop. time press enter loop complete , available table last 1 created table c.you can use array of tables store every table string created.retrieve , attach event


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -