Jump to content

convert chart to an array


jasonc

Recommended Posts

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

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><?
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.