multiple actions including mailto()
Posted: Sat Jan 21, 2006 8:34 am
User is viewing one record from a database, the id number of which is stored in a $_SESSION variable. When the viewer clicks on a link (button actually) I want the following to happen.
1. A flag in that record in the db is updated.
2. The email address and some other info is retrieved from the db.
3. The mailto() function is invoked using data from step 2
4. The $_SESSION variable is unset()
5. The screen is reset.
Step 3 needs to invoke the user's email client with address and subject filled in.
Step 5 ditches the record view and returns to the list view.
The order of events does not matter, except that step 5 needs to be last.
I know, of course, how to do each of the individual steps, and I've been doing a variant of them using the mail() function. The problem is that that doesn't leave the user with a record of the sent mail (which could be overcome with a cc), but in this case mail() is not working anyway.
The host (and this is not uncommon on shared hosts) stores mail() messages and sends them based on server load, so they may be delayed significantly. So using the regular email client is to their advantage for a number of reasons. I don't have a problem using mailto() by itself in a <href>, but I'm not having much luck making it automatically one of a series of actions.
The present process is within a javascript popup which accepts message input, but I am in the process of reworking this site to eliminate all javascript (another reason for the change from mail() to mailto()) so I would really like to aviod using it here if at all possible.
Anyone?
1. A flag in that record in the db is updated.
2. The email address and some other info is retrieved from the db.
3. The mailto() function is invoked using data from step 2
4. The $_SESSION variable is unset()
5. The screen is reset.
Step 3 needs to invoke the user's email client with address and subject filled in.
Step 5 ditches the record view and returns to the list view.
The order of events does not matter, except that step 5 needs to be last.
I know, of course, how to do each of the individual steps, and I've been doing a variant of them using the mail() function. The problem is that that doesn't leave the user with a record of the sent mail (which could be overcome with a cc), but in this case mail() is not working anyway.
The host (and this is not uncommon on shared hosts) stores mail() messages and sends them based on server load, so they may be delayed significantly. So using the regular email client is to their advantage for a number of reasons. I don't have a problem using mailto() by itself in a <href>, but I'm not having much luck making it automatically one of a series of actions.
The present process is within a javascript popup which accepts message input, but I am in the process of reworking this site to eliminate all javascript (another reason for the change from mail() to mailto()) so I would really like to aviod using it here if at all possible.
Anyone?