This is a discussion on Creating arrays within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I am building an introductory level (and no doubt crude) online shopping facility for a small site. I would ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I am building an introductory level (and no doubt crude) online shopping facility for a small site. I would like to use a form (generated from a MySQL db) that either allows the user to input a quantity for each item (only 7 or so products so far) then submit the form and add the selected products to an array. This array will then need to be read through a script that will calculate the subtotal etc. I have a MySQL db with all the relevant info in as I use this in another section of the site - I just don't know how to write the PHP to add to the array, store the array and then read it back! Can anyone help? Thanks in anticipation, Paul Marshall paulm844 @ netscape.net |
|
|||
|
"paulm844" <paulm844@netscape.net> schreef in bericht news:3F66414F.6030309@netscape.net... > Hi, > > I am building an introductory level (and no doubt crude) online shopping > facility for a small site. I would like to use a form (generated from a > MySQL db) that either allows the user to input a quantity for each item > (only 7 or so products so far) then submit the form and add the selected > products to an array. This array will then need to be read through a > script that will calculate the subtotal etc. I have a MySQL db with all > the relevant info in as I use this in another section of the site - I > just don't know how to write the PHP to add to the array, store the > array and then read it back! > > Can anyone help? > > Thanks in anticipation, > > Paul Marshall > paulm844 @ netscape.net > Paul, What kind of form, with or without validation, with descriptive labels or do you use the (usually) less descriptive field-names from the table? I can think of many more questions when creating a HTML form and creating a Form is basic HTML and this is not the subject of this news group. If this should be generated by a PHP script you still need to answer a lot of these questions first. And even if you have answers to this is I do not think you should expect somebody to give you a full script for creating these forms. You have to do some work on your own (their are many examples on the net, search for it in google) This is the same for adding items to an array, this is PHP basic! The best way for getting help on PHP language basics is by reading a good tutorial. You can get some tutorials from the web (or buy a book) Storing information can be done in more then one way. Choosing the right one will depend on your business logic and constraints. It can be stored in a cookie, in a file, in the DB or in hidden fields in a HTML form element. (just to name a few ;-)) All of these have their advantages and disadvantages. We can't make these decisions for you. It seems to me you should read some basic tutorials first before going any further and maybe you should reevaluate your project and answer a few of these design questions first. Or maybe you could rephrase your questions to be more specific and PHP related. HTH Rob |