|
Hi again.
would anyone explain to me how/ if i can set a loop that will increment the variables in it by one with each revolution?
for example: id like the first loop to read from $_SESSION[apwidth1] but the 2nd loop to read from $_SESSION[apwidth2]
1st time:
for(1;$numbeds;$i++)
{
$_SESSION[apwidth1]
}
2nd time:
for(1;$numbeds;$i++)
{
$_SESSION[apwidth2]
}
Obviously my loop will be a little more sophisticated, its just an example.
To put you in context im designing a website for a sliding wardrobe door company. it will enable customers to enter an aperture width/height, and the php will decide how many doors of what size they require. then the customer will choose a colour and the php will look to mysql for the price of however many doors of what size in their chosen colour and output a total price. I finished the php/ mysql section yesterday and ive been informed today that most customers have more than 1 bedroom and therefore need more than 1 set of doors (up to 4), so without duplicating my php 4 times (which would be a very long haul) id like to set a loop that rotates for $numbeds(number of bedrooms) and increments the variablenames involved within it by 1 each time so when it comes to the end and the total price of each bedroom is calculated i will end up with bed1price +bed2price +bed3price, as opposed to bed1price + bed1price +bed1price.... Am i asking too much?????
Thanks guys
|