Hello,
I have created a stock control system to allow admin staff to keep track of incoming and outgoing stock.
However I have now been told that they want to be able to process several items to one department at a time.
I would like to know what the best way of doing this is, I was thinking about something along the lines of a Shopping Basket but have never dealt wth anything like this before.
I did similar by having a text area on a page, and each time they want to pick an item I popped up a new window and used JS parent.opener to send back the code number and a text description into the text area.
I liked using that idea because, a) if ppl know the id number of the item they can just tap it in themselves, b) they can easily delete an item.
Its just a matter of analysing the numbers in the text area when the form is submitted, and maybe giving them visual confirmation of what they just did, or asking them to confirm before really committing.
You could do the same with frames, or with Ajax, or purely JS on a page - there should be some examples on javascript.intenet.com of how to shift values from one picklist to a text area.
Firstly I have never really done much work with Javascript, and secondly I dont quite understand how putting the data into a text field would then allow me to query the database to carry out all of the necessary functions.
Sorry if I am making things difficult for you but I am quite new to using PHP and am still learning.
Ok, if you dont use/understand JS, this would be a bridge too far for you.
Try this instead:
How about you make an “optional page” ( “Ordering more than one product? Go here” ) that has all your products and an input box for how many can be ordered of each type.
Lets say they enter 150 on that input box… so then on your postback form you’d do something like:
echo $_POST['product'][270198] // and you'd see "150"
Then you could see how to deal with anything where each $_POST[‘product’] array contains a value, and save it.
(hint L use print_r( $_POST[‘product’] ); to see what is being sent )
What you’d likely want to do though is then set a min and max order number for each item. I mean do you want to process an order for 1 pen or 100 waste paper baskets, y’know what I mean … just in case of user error.
Even if you don’t use the idea as is, hacking it up should get you going …
thank you for that, I shall have a go and see what I come up with, someone else has recommended I use sessions and create something a bit like a shopping basket, what is your view on this?
If your app is on an intranet only, then yes go for sessions.
If your understanding of security is shaky, and you app is available to anyone over the web, then OK, use sessions but read a lot on security and sessions.
I’d say test/mock up both methods, especially when you are thinking of your worst user y’know the technophobe who forgot their glasses today and wants to order just 3 pens and 100 waste paper baskets.
How do you confirm what is being done, how do you abandon the basket, how do you take things out …
That kind of real world requirement.
(can someone really order 100 waste paper baskets when you probably only carry a stock of what, 3?)
If youv’e never passed around multi-dimensional arrays from form to page, then you may find that tricky enough for now, and I’d advise you try that method first - while you’re at it, if you aren’t familiar with the ~80 php array based functions, well this’ll sure get you started.