php - Generate input submit for each column from sql table -


i have mysql table 34 columns , need submit button each 1 value identical column name in order perform sql query on submit. example:

<input type="submit" name="column1" value="column1" /> <input type="submit" name="column2" value="column2" /> //etc. 

is there method generate inputs automatically required names , values? automatically generate new submit input when add column table?

the farthest i've come this:

$connect = mysql_connect("localhost","user","pass"); mysql_select_db("db1"); $query = mysql_query("select * tb1"); echo "<input type="submit" name="$db" value="$db" />"; 

this is, of course, absolute rubbish. but, saying, far i've come. appreciated.

you need loop through results , echo input button inside it.

also, can display button each column in table, need know how many columns table have. achieve @ least in 2 ways:

  1. you can use sql query:

    select count(*) information_schema.columns table_name = 'tbl_yourtable' 
  2. in loop, can count number of elements / index exists in array using, example, count function of php.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -