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

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?

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

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 ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.