I need to insert specific array values in a HTML form. I query, fetch and array from a mysql table. When I print_r($array) I get the below output.
Question: Let´s say I want to echo out the value Dæk Bag
to a html form question, how do I do that?
INFO: I have 40 questions in the form.
Ps. The app is for own use only, and I am aware of the use of mySQLi or PDO instead of mySQL -> It will be change asap.
Array:
Array
(
[0] => 1
[id] => 1
[1] => Dæk For
[title_task_DK] => Dæk For
)
Array
(
[0] => 2
[id] => 2
[1] => Dæk Bag
[title_task_DK] => Dæk Bag
)
Array
(
[0] => 3
[id] => 3
[1] => Dæk Alm.
[title_task_DK] => Dæk Alm.
)
Array
(
[0] => 4
[id] => 4
[1] => Dæk Indl.
[title_task_DK] => Dæk Indl.
)
Array
(
[0] => 5
[id] => 5
[1] => Slange/Lapning For
[title_task_DK] => Slange/Lapning For
)
My PHP code:
<?php
$results = mysql_query("SELECT * FROM task_list");
while($array = mysql_fetch_array($results)) {
print_r($array);
}
?>
My mySQL table:
CREATE TABLE `task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title_task_DK` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8;