Hi, great form and I had no problem getting it to work fine.
I would like to add the form to several different pages in a site, each of which will have a different recipient. I would not want the recipient email address in the form though (because of spam I'd want it to be invisible to users), rather a reference number and then the email addresses in the process.php or somewhere else.
So the form might send '123'to process.php and go to bob@site1.com, or '246'and go to dave@othersite.com and so on.
I imagine I setup a hidden recipient field in the form with '123', '246' etc but what do I change in process.php? Or do I need a completely separate form and process.php for each page?
Thanks very much
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Add somthing like this prior to the mail() function in the process.php file:
//Code 1 from form 1, send to email1
if($hidden==code1){
$hidden="email1";
//Code 2 from form 2, send to email2
} elseif ($hidden==code2) {
$hidden="email2";
//Email when code is not recognized
} else {
$hidden="defaultemail";
}
Add more codes by adding more elseif statements.
Then change this line:
mail("sendemail@domain.com","Form Submitted at your website",$message,"From: phpFormGenerator");
to something like this:
mail($hidden,"Form Submitted at your website",$message,"From: phpFormGenerator");
Each copy of the form must have the $hidden field set to the appropriate code number.
Let me know if this is what you are looking for.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, exactly what I was looking for, thanks.
Now I've done that I'm starting to wonder whether I should use an array rather than if / elseif to try and separate the data from the processing code, and then later I'll worry about whether I should include data at all in a 'process' form, but those problems are for another day.
Thanks again for your help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, great form and I had no problem getting it to work fine.
I would like to add the form to several different pages in a site, each of which will have a different recipient. I would not want the recipient email address in the form though (because of spam I'd want it to be invisible to users), rather a reference number and then the email addresses in the process.php or somewhere else.
So the form might send '123'to process.php and go to bob@site1.com, or '246'and go to dave@othersite.com and so on.
I imagine I setup a hidden recipient field in the form with '123', '246' etc but what do I change in process.php? Or do I need a completely separate form and process.php for each page?
Thanks very much
Anything is possible with simple modifications.
Add somthing like this prior to the mail() function in the process.php file:
//Code 1 from form 1, send to email1
if($hidden==code1){
$hidden="email1";
//Code 2 from form 2, send to email2
} elseif ($hidden==code2) {
$hidden="email2";
//Email when code is not recognized
} else {
$hidden="defaultemail";
}
Add more codes by adding more elseif statements.
Then change this line:
mail("sendemail@domain.com","Form Submitted at your website",$message,"From: phpFormGenerator");
to something like this:
mail($hidden,"Form Submitted at your website",$message,"From: phpFormGenerator");
Each copy of the form must have the $hidden field set to the appropriate code number.
Let me know if this is what you are looking for.
Yes, exactly what I was looking for, thanks.
Now I've done that I'm starting to wonder whether I should use an array rather than if / elseif to try and separate the data from the processing code, and then later I'll worry about whether I should include data at all in a 'process' form, but those problems are for another day.
Thanks again for your help