Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recipe Calculator

Status
Not open for further replies.

brainpudding

Technical User
Sep 29, 2002
84
US
I have a web site that wants 6 different recipes and they want to be able to change the number of people ti serves and then have all the nigredients change to match. I have NO idea how to do this .. anyone have any suggestions?
 
it would involve some math- but if you could have the base figures for a one person serve, and make a loop so that if they say they want to serve three then the quantity will be times by 3. Sadly as far as cooking goes- if its an in the oven job the cooking time changes as well.
You should be able to do this with javascript, asp or php- try going to one of the javascripting resource sites if you don't have access to a server side scripting facilty.
I think it's javascript.com Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Stick the quantities for one person in a db then when you display the recipe just use this for each quantity

Code:
<%
thisQuant = rsYourRecordset.Field(&quot;fieldname&quot;).value * numOfPeople
Response.Write thisQuant
%>

or whatever you need just change the script to suit.

Cheech [Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top