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. Quote Link to comment 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. Quote Link to comment 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><? } Quote Link to comment 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) { Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.