I am trying to set up an order page for website. I just want one page that the quantity and options are entered and then a resulting page is echoed that the customer can then print and mail in the order. My question is this. I have a database and in my code, I really do not want to hard code all the variables into the code. I want them generated based on the results from a column in the mysql database. My table for example:
id|product|description|price|o1|o1a|o2|o2a (o1 stands for option 1)
jug|asian jug|great widget!|2.50|color|red,blue,green|size|large,mediu m,small
jar|fruit jar|grest christmas gift!|100.00|size|large,small|||
saltshaker|mrs. saltshaker|great christmas gift!|10.00|size|large,small|||
I took some code from a tutorial and trying to adapt it to my needs, but I am seeing very fast that I am having to hard code variables in and if the database changes, I will have to recode everytime. I need some advice on how to do this. I think it has something to do with variable variables, but I am new to coding. Any help would be appreciated. I have a form and the form processing code below that I have done so far.
and here is the form processing code I have done so far at processingorder.php....
See? Instead of hard coding $jugprice for jug or $jarprice, I want these variables generated on the fly from the database. Any ideas? example is here
http://www.somethingsouthernpottery.com/orderform.html of what I am building.
PS: I do know that I do not have any sql statements yet linking to my database. I just wanted some advice first.