-
Sending an entire page by email
Hi everybody! Here is my "scenario":
I have a page with several items in a table (like a catalogue) that I can select using checkboxes.
Once selected any number of items I send the information to another page that shows only the selected items and, using some javascript, shows some calculation results on the fly (like sums and multiplications) to get each item subtotal, total price and quantity etc.
Everything works just fine and the resulting HTML page looks nicely formatted and ready to go. 
Now, I would like to send the page as it is (or at list the entire form inside the page) to me, by email.
How can I do that? I tryed with innerhtml but i can't have it to work. And I am not so good in javascript... And I never used maill() in PHP before.
I would like to do this without coding another page full of input boxes, even because the number of results in the page may vary depending on the previous selections.
Any suggestion?
Thanks Alex Piotto
Last edited by Piotto; 11-14-2009 at 09:09 AM.
Reason: Sorry i forgot to add a link to see... Please have a look here: http://www.ikonos.co.mz/demo004/catalogo1_view.php
-
-
If you want a complex system of data management, the best idea is to start by taking a step back and reworking the whole system. Yes, it would be a lot of work, but it would give you more control over the events/format.
Basically, you can use PHP to organize the data in the first place and assign each part a number or other way to identify it. Javascript then allows figuring out which one you selected (or even PHP, via a form), and you can take that information, gather up (based on the number/reference) the same data you had before, then format it (differently if needed) as an email.
If you cannot do all of this, then the only real approach is to attempt to get the active html on the page, but I really don't know how you could even start on doing this accurately using Javascript. Maybe someone else will have a better idea.
Again, though, I encourage you to think about other approaches to the problem, because in the end it might be easier. Frequently once a new layer of complexity is added to this type of problem it is easier to just rework in a big way, because despite the extra work, it will save you a lot of time (and frustration) in the end.
The ideal system here would be not sending the html, but instead just using the checkboxes to figure out which items are of interest, then query the database again to find the information for the "email view" or whatever, and send it along that way. That is how large scale online stores work, but having a productid and storing that in your cart, in your orders, etc., and gathering the details about that id from the database when needed.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
Hi Daniel and thanks for the reply. (Grazie, Obrigado!)
Let explain a bit more...
The catalogue page come from a simple flat DB (not yet mysql sorry!) and contains an ID, product name, unit price, a description field and a quantity field.
User views the catalogue and selects one or more items (via checkboxes) that he wants to purchase.
Until here is PHP only.
When the page is submitted it calls an "invoice" page that shows only the selected items names, unit prices and quantity. It is possible to change the quantity values on the page, and the javascript in the head of the page will do the calculation of total etc on the fly. Below I putted some textboxes for name, address, telephone etc.
The invoice page user can see is nice and looks already like a real invoice. I would like to send to me what i am seeing.
I know i can retrieve the input fields from the invoice page and send them to an Email page, but as the number of product fields may be 1 or any other number it make me confused about how to loop through the results.
That's why i was thinking of innerhtml or similar... or even get the source code of the invoice page and save it in a file for later sending...



Alex Piotto
| Ciao, sono italiano! | E falo português! |
Last edited by Piotto; 11-14-2009 at 09:10 AM.
Reason: Sorry i forgot to add a link to see... Please have a look here: http://www.ikonos.co.mz/demo004/catalogo1_view.php
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks