CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Send a mail with informations from 2 tables.

Print topic Send  topic

Author Message
bouvet

Posts: 24
Posted: 06/08/2004, 8:59 AM

I have
· a table with products: products
· a table with users: users


I want to:
· make a login with user login and user name – (I can do it)
· have a table with products. – (I can do it)
· choose one product– (I can do it)
· say OK
· want to send me a email with user name and the product he has choosen. – I can’t send a mail with all these informations

I don’t need a shopping cart, don’t need to save the data, just send me a mai lwith all these informations.

How do I have to procede?

Thanks Philippe:

_________________
Webdesign Hildesheim Hannover
http://www.actidesign.com
View profile  Send private message
Anothersledhead


Posts: 44
Posted: 06/08/2004, 11:20 AM

I did a similar thing in an application I built. Here is how I did it.

1) I created a record with a custom SQL statement as a datasource.

2) I then wrote the SQL statement something to this effect ---SELECT customers.customer_email AS to_email, CONCAT(customers.customer_name, " your quote is ready") AS subject CONCAT("Your quote is ready you can login to view it at http://www.somedomain.com with the following username and password<br><br>Username: ", users.user_login, "<br><br>Password: ", users.user_password) AS body FROM customers, users WHERE customers.customer_id = users.customer_id ----

3) Now create three text boxes and one text area on the record form.

4) Name the three text boxes and text area to_email, from_email, subject and body respectively. By naming the controls the same as your SQL statement they should now populate when the page loads. You will need to fill in the from email yourself.

5) Like yourself I didn't need to save the data so I removed all of the buttons except the cancel button. I then duplicated the cancel button and then renamed one of the buttons send.

6) I then set the onclick event of the renamed cancel button to send the email.

There might be a cleaner way of doing things but this works fine for me it also allows you to edit the email before it goes out.

Hope this makes sense
View profile  Send private message
Anothersledhead


Posts: 44
Posted: 06/08/2004, 11:22 AM

One thing I forgot is that have the email set to send as html that is the reason for the line breaks in the SQL statement.
View profile  Send private message
Philippe
Posted: 06/08/2004, 11:02 PM

Thank you for your help. It seems simple, but I have some diffuclties. Could you send a bit more of code? I really feel like a newbie for it !:-<
Philippe


Quote Anothersledhead:
I did a similar thing in an application I built. Here is how I did it.

1) I created a record with a custom SQL statement as a datasource.

2) I then wrote the SQL statement something to this effect ---SELECT customers.customer_email AS to_email, CONCAT(customers.customer_name, " your quote is ready") AS subject CONCAT("Your quote is ready you can login to view it at http://www.somedomain.com with the following username and password<br><br>Username: ", users.user_login, "<br><br>Password: ", users.user_password) AS body FROM customers, users WHERE customers.customer_id = users.customer_id ----

3) Now create three text boxes and one text area on the record form.

4) Name the three text boxes and text area to_email, from_email, subject and body respectively. By naming the controls the same as your SQL statement they should now populate when the page loads. You will need to fill in the from email yourself.

5) Like yourself I didn't need to save the data so I removed all of the buttons except the cancel button. I then duplicated the cancel button and then renamed one of the buttons send.

6) I then set the onclick event of the renamed cancel button to send the email.

There might be a cleaner way of doing things but this works fine for me it also allows you to edit the email before it goes out.

Hope this makes sense
:-<
peterr


Posts: 5971
Posted: 06/09/2004, 12:51 AM

Philippe,

Have you maybe tried:
a) the method described at http://docs.codecharge.com/studio/html/QuickStart/EnhAp...SendEmails.html
b) the Send Email action: http://docs.codecharge.com/studio/html/Actions/Server/Send%20Email.html

In both cases you would use that code or action in the "After Update" or "After Insert" event, but if you don't need to update the database then you can use the Search form (it is sam as Record form but it doesn't have Data Source) and use OnClick event of the Search button (rename it to "Submit"), or maybe in the page's After Initialize event check if any parameters were submitted by the Search form and then use them to create the email.
I haven't tested these approaches, so these are just general ideas.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Philippe
Posted: 06/09/2004, 1:22 AM

the idea with search form seems interessant. I will try it. Tahnks


Quote peterr:
Philippe,

Have you maybe tried:
a) the method described at http://docs.codecharge.com/studio/html/QuickStart/EnhAp...SendEmails.html
b) the Send Email action: http://docs.codecharge.com/studio/html/Actions/Server/Send%20Email.html

In both cases you would use that code or action in the "After Update" or "After Insert" event, but if you don't need to update the database then you can use the Search form (it is sam as Record form but it doesn't have Data Source) and use OnClick event of the Search button (rename it to "Submit"), or maybe in the page's After Initialize event check if any parameters were submitted by the Search form and then use them to create the email.
I haven't tested these approaches, so these are just general ideas.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.