I have a few websites with a variety of forms.? I want a script, to be hosted on one of my websites, that all my forms can post to.? The script will take the form input, reorder it according to the name of the form fields, and then send them to an email address? stored in a local database.
The forms will contain text, hidden, radio, and other fields.? These fields will be named, of course, and prefixed with numbers... like
03name
02subject
01email
etc.
The numbers will dictate the order in which the fields should be placed in the email... for example, the fields above would be included in the email, double spaced, like this:
email: to be put in from field, and as first item in email
subject: goes on subject line and as second item in email
name: [form value goes here]
etc.
Each of the forms will have a different number of fields with different names, but all will use the naming convention above.? Each form will have a? field prefixed with a zero, a one and a two.?
The zero field? will contain the lookup value to find the email address? in the database.? ? ? The email will be sent to this address.
The one field will contain the email address to be placed in the FROM header.
The two field will contain the value to be placed in the SUBJECT of the email
The remaining fields, 3 - ?, will be included in the body of the email in numeric order.
The script will :
1) read the variable names and values posted from the form
2) lookup the email address from the database using "zero field" value as key
3) reorder the fields according to the order specified by the numeric prefixes, separate the numbers from the text? and place them in the body of the email in numeric order (as above)
4) create a subject using the "two field" value
5) create a from address using the "one field" value
6) send the email to the value looked up in the database; if no value is found, it will send the email to a hardcoded address in the script, which I will provide.
The script should be able to work with any form that posts data to it.
## Deliverables
There is one more thing... if a form posts to the page, and it does not have numbered fields, this email should also be sent to hardcoded email address.
And now that I think about it, the email should always capture the website address of the form that posted to it.
That's it, I'm looking to get this done ASAP.
Tx,
George