For my prototype I wanted to get a good understanding of how I could use php to process data entered by users. My idea was that I would have a number of items that a user could select and after submitting that data, php would process it and convert those values into information which showed the user how much meat would need to be produced if everybody had the same diet.
As I just wanted to get a better understanding of how I would write the code for the project, I used chicken as my example, as it is much easier to calculate how many chicken legs there are in a chicken than it is to find out how many steaks there are in a cow (which is something I will inevitably have to do, and have started to research).
The page shown above allows the user to enter in the meat they eat, once they have entered the meat they eat (it’s supposed to be during the week), they hit the “calculate” button.
After the user has clicked the calculate button, the data is shown in a table. The quantity is added up to how many animals that amounts to (there are 2 chicken legs on a chicken so therefore 6 chicken legs make up 3 chickens.
After that I created a simple variable which calculated the total multiplied by 7 billion, which would show the user how many chickens it would take to feed everybody if the entire world ate the same amount each week.