First off, I am a PHP NOOB. I am currently trying to develop a PHP page that is suppose to calculate a monthly budget for you and I am having problem with one section of it.
I am having problem with my food variables. I can't give you the syntax I have for the "foodPerMonth" array because I simply don't know how to write it. Everything I've written so far is wrong.
Anyhow. This is how I want it to work.
I have my html form. I'm making it shorter just for the food part. You are suppose to type in how many i.e "Adult Woman" you want in your budget. And I will have a variable for each of those that will contain the cost per month for each person.
<form action="function.php" method="post">
<label>Adult Woman: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Adult Man: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Juvenile Girl: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Juvenile Boy: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Child Girl: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Child Boy: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Baby Girl: </label><input type="text" name="foodPerMonth[]" /><br />
<label>Baby Boy: </label><input type="text" name="foodPerMonth[]" /><br />
<input type="submit" value="Submit" />
</form>
What I want to know is how do I type this kind of array that will go with the form and etc.
I would also appreciate if someone could thorougly explain how arrays and keys work and how they are used and what they are used for. Doesn't matter how much I read the fact in the manual. It wont stuck.
Thank you in advance for answering, all help will be greatly appreciated.