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:
you can use sql query:
select count(*) information_schema.columns table_name = 'tbl_yourtable'
in loop, can count number of elements / index exists in array using, example, count function of php.
Comments
Post a Comment