Hi everyone,

At my office we have a webshop which has a section for users to insert discount codes to enable customers to get money off.

Currently users of the back end system can use a simple form to insert all the data and click submit.

Data that needs to be inserted is

Discount Code
Books Per Transaction
No. Of Transactions
% Discount
Start Date (D/M/Y)
End Date (D/M/Y)
Associated Products (This is a list of products and more than one can be selected)

The problem we have come to is that about 300 codes need to be inserted, and 150 of them are unique to one kind of discount, and another 150 is for another discount, but for each of these two different discounts the terms are the same just the codes are different.

What i need help with is that is there a method to enable a user to like import a list of codes from either an excel spreadsheet, or a text file, and that the php will read each line of the text file, and using the settings in the form (which are preset such as books, % discount, Start / End date, and Products) insert all of the different codes.

Any ideas would be great...Sorry to put URGENT on there but this needs to be completed asap for an event.

Thanks very much

Rodent

    Rodent:

    I have read your posting about 10 times and I can't figure out what it is you are trying to do?

    Yes, PHP can read from a text file.

    You could possibly put your information in an array or you could possibly use a database, but I still don't know what you are trying to do.

    Maybe someone else can figure out what you are saying, but I don't get it.

    Good Luck

      Sorry u cannot figure out what i am trying to do.

      I have 150 discount codes to place in our database for our webshop, and people wishing to buy products can insert one of these codes into the payment section and they will recieve a specified discount. Now these 150 codes have different code numbers, but the other information about them are identical (the identical information being number of books they can purchase, start data, end date, % Discount, etc)

      What i need to be able to do, is insert all 150 codes in one fell swoop because the only information that changes between each code is the code itself. I hope you are with me so far.

      So if i have a text file, is there a method that the text file can read through each code kept within it and foreach code insert the other information stored in the form (start data, end date, % Discount, etc which does not change) Therefore instead of placing the same information again and again and just changing the code, i can select a text file from my computer (running local on intranet) and i can update the codes quickly.

      I hope this better explains.

      Sorry again

      Thanks for helping - Rodent

        Well...i was just thinking, even better would be a way of the user pasting a whole list of codes into a text area box, and then for each one of those insert the rest of the information

        Is this possible too?

          Rodent:

          Most everything that you are asking IS POSSIBLE. jmosterb posted some good links for you to check out.

          The problem is, figuring out how to do it.

          Are these 150 codes always changing?

          I still have not figured out just how your program is supposed to work, but that really doesn't matter. But it seems to me that if a user has to enter a whole list of codes:
          "a way of the user pasting a whole list of codes" then perhaps you need to re-design the program.

          I certainly wouldn't go to a Web site where I had to enter a whole list of codes to get a discount. I would exit the Web site and go somewhere else.

          Good Luck

            Write a Reply...