jasonc Posted November 18, 2010 Share Posted November 18, 2010 I wish to access the following chart by the number and the headings names. field text mysqlfield 1 username Please enter a username un 2 name Please enter you name nm 3 age Please enter your age ag 4 town What town do you live in tw 5 postcode What is your postcode pc I place the field and the text in to a form and use the mysqlfield to placce the data in the mysql database. what i do not know is how to store the array data and how to access it. Link to comment https://forums.phpfreaks.com/topic/219131-convert-chart-to-an-array/ Share on other sites More sharing options...
AbraCadaver Posted November 18, 2010 Share Posted November 18, 2010 You're going to have to explain a little more. Link to comment https://forums.phpfreaks.com/topic/219131-convert-chart-to-an-array/#findComment-1136365 Share on other sites More sharing options...
jasonc Posted November 18, 2010 Author Share Posted November 18, 2010 ok been playing around with stuff from php.net site. this is what i have, but how do i get the number 1,2,3,4,5 ? $array = array( '1'=> array('fieldtext'=>'option1', 'mysqlfield'=>'mysql1'), '2'=> array('fieldtext'=>'option2', 'mysqlfield'=>'mysql2'), '3'=> array('fieldtext'=>'option3', 'mysqlfield'=>'mysql3'), '4'=> array('fieldtext'=>'option4', 'mysqlfield'=>'mysql4'), ); foreach ($array as $options) { foreach ($options as $key => $value) { echo("number = [". $number . "] - key = [". $key . "] - value = [". $value . "]<br>"); } ?><br><br><? } Link to comment https://forums.phpfreaks.com/topic/219131-convert-chart-to-an-array/#findComment-1136368 Share on other sites More sharing options...
AbraCadaver Posted November 19, 2010 Share Posted November 19, 2010 foreach ($array as $number => $options) { foreach ($options as $key => $value) { Link to comment https://forums.phpfreaks.com/topic/219131-convert-chart-to-an-array/#findComment-1136741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.