Hello! Faced the problem of passing variables and form values, all at the same time Here is the script:
<form method="post" action="InsDateTB.php"> <?php $Table=strip_tags($_GET["table"]); $selDB=strip_tags($_GET["selDB"]); $connect = mysql_connect('localhost','root','12345'); mysql_select_db($selDB); $sql="SELECT * FROM $Table"; $result=mysql_query($sql,$connect) or die("Query failed: " . mysql_error()); $i=1; print "<table>"; print "<tr>"; while ($i < mysql_num_fields($result)) { $field = mysql_fetch_field($result,$i); print "<td>"; print "Поле: $field->name<br>Тип: $field->type<br><input name='$field->name' type='text'>"; print "</td>"; $i++; } print "</tr>"; print "</table>"; ?> <input type="submit" value="Добавить"> </form> </body> </html>
On the page specified in action - InsDateTB.php - you need to transfer not only the values entered in the input fields, but also the values of the variables $ Table and $ selDB ... I know that variables can be transferred in this way:
print "<a href='InsTB.php?table=$Table&selDB=$selDB'>Добавить данные</a>";
but how to combine it with pressing a single button? ...