0

Hi everyone

I am new to php or programming but am learning very quickly. only thing is i have been asked to build a site for a company that sells blinds, so the user needs to enter in measurements and i need to do a 9d array or 7 tables, tables i know how to do but how do i start to do an array?

all help will be great

thanks
warren

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Will Gresham
0

Arrays are fairly simple, the below example is untested and is just a simple sample to show how it works:

$blind_details = array(
"width" => "$value",
"height" => "$value$value",
"material" => "",
"colour" => "$value",
"style" => "$value",
);

You can add more or less items to suit. Then to retrieve data you can do it multiple ways:
1.

echo $blind_details['height'] . "<br />";
echo $blind_details['width'];
etc...
// Would output:
// $value

2.

foreach ($blind_details as $key => $value) {
  echo $key . " is " . $value . ".";
}
// Would output:
// width is $value.
// height is $value.
// material is $value.
// colour is $value.
// style is $value.

Get the idea?

0

thanks for that, so would my table just consist of 2 columns, height and width?

0

Just modify the code in my previous post with the columns you want in the table, obviously change $value to whatever you want to store in the array ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.