Wanting to perform a email order from product in database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mariusx
Forum Newbie
Posts: 3
Joined: Sun May 21, 2006 4:06 am

Wanting to perform a email order from product in database

Post by Mariusx »

I am wanting to set up an HTML form that the user can enter quantities of the products they want to order. once they have entered the amounts the amount need to be check against the database that there is sufficent stock and then deduct that from stock and email to the company the order.

the form is currently dynamically created with the list of fields from the database being
Name, Price, Unit, Available. these fields are displayed in table rows. I had added a text field called Order on the end of each row with the name of the field being the name of the product stored in the Name field.

When I post the order from this page I need to be able to collect the list of product that have had quanities entered and then display the list with a confirm order.

Once the user clicks confirm the next step is to deduct the product from the database (if someone else has ordered product and there is no longer enough stock they need to be taken back to the order form with the current stock level shown and there original order in the field so they can adjust it.) and generate an email to be sent to the company showing the order being sent through. the order will be identified by a client number used to log in.

could someone please give me some Ideas on how to do this process
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Post by ianhull »

What I would do is use a dropdown select which displays the results of the amount in stock. and on submit of the form, check that the value selected for order is not greater than the amount available.

Once you have done this then use an update query to deduct the amount of stock available by whatever the amount was that has just been purchased.
User avatar
andym01480
Forum Contributor
Posts: 390
Joined: Wed Apr 19, 2006 5:01 pm

Post by andym01480 »

There was another thread on this sort of thing recently, where a problem was identified of orders not completed - they may have been removed from the stock level in the database but the order was not completed. There were some helpful suggestions on implementing what you want....

viewtopic.php?t=48589
Mariusx
Forum Newbie
Posts: 3
Joined: Sun May 21, 2006 4:06 am

More Details

Post by Mariusx »

The site will only be used by existing clients that has proven to be trustworthy. also when the user submits the order they will be asked to log in with there client number and pasword of there choice, this will prevent the stock being deducted by people wanting to be nasty.

the drop down Idea will help to enforce the stock wanted is not larger then the current stock. I will try and implement that.

this still leaves me with the problem of myself not knowing how to pick up the results from the form of stock that is requested by the user. I need to know how to dynamically pick up the stock selected, present the order on the screen with a confirm button. when they click confirm they will be asked to login in. if not already logged in and they it will process the order, deduct the quanity and email the order to the Company, may also produce an internet email invoice for the client.

The company does require the level of stock to be displayed because it is a fish of the day blackboard site.

Image

The field names are currently not showing on the page but they will soon. the fields are
Name, Price, Unit, Quantity, and Amount ordered.

also can php add a $ to amounts or do I just need to code it in to add to the string?
Post Reply