Thread: Conditions for formmail
Results 1 to 6 of 6
Related
-
PHP formmail problem Forum: PHP Forum
Replies: 3 -
FormMail.pl Forum: CGI Perl Forum
Replies: 4 -
FormMail Help Forum: CGI Perl Forum
Replies: 15 -
Formmail help Forum: CGI Perl Forum
Replies: 1
-
01-24-2005, 11:37 AM #1
Conditions for formmail
Hi there,
I apologise in advance in my lack of knowledge but I have a problem im stuck with.
Im currently working on a college project in php whereby dependent on the value entered in a html form the contents are emailed to the relevent recipient. So for example if the value was greater than 5000 it would be emailed to x and if less than would by emailed to recipient y.
Currently I can only get the form going to both parties. Is this possible using php? Im not converse with php scripting and only have knowledge of using the formmail script provided by my hosting company.
Any help would be greatly appreciated.
Many thanks
Mark
-
01-25-2005, 09:45 AM #2
Hiya, welcome to the forums.
Your going to have to throw the generic formailer out the window, and code something yourself.
PHP is very capable of deciding who to send to based on any data at all.
Code:<?php if ($variable > 5000) { $mailto = "bob"; } else { $mailto "jim"; } ?>
Feel free to post back if you need more help, and no need to apologise for a lack of knowledge, thats how we all got hereIf one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
01-25-2005, 10:08 AM #3
Many thanks for your repsonse!
I had a look over the mail function and got something to work which I was really happy with.
I was worried of the security implications of coding a script like that myself from scratch.
Would you not suggest altering the formmail script directly to include an IF statement?
Im currently using the PHORM form to email processor.
Thanks again for your help.
Regards
Mark
-
01-25-2005, 10:20 AM #4
PHORMS's actually pretty good. It's definitely not going to hurt to amend that instead of writing your own. However, its never too early to learn about security and writing one yourself is going to teach you that. Mail forms are a pretty good way to learn, as they teach you to validate user entry (EVERYTHING that a user can enter should be validated to death) without the risk of SQL Injection (A popular form of attack, using inputs).
Obviously, its up to you. Chances are, if you amend PHORM without a good knowledge of security, its quite possible you will make it insecure anyway. I would suggest bone up on the simpler aspects of good PHP coding practices and write your own.If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
01-25-2005, 01:52 PM #5
Thanks for your advice on creating my own script, its something I would like to do however as I mentioned previously this is a college project and Im on a strict deadline!
I have ammended the PHORM script to allow for the if statement to occur as shown below.
Code:if( $_POST["amount"] >= 5000 ) { $PHORM_TO[1] = "me@mydomain.com"; } else { $PHORM_TO[1] = "me@anotherdomain.com"; }
Thanks again
Mark
-
01-25-2005, 02:04 PM #6
You could check with is_numeric to make sure its a purely numeric value.
Alsom, following the link above, there are some functions to convert the value to a number, so if someone type £2,500 it will automatically become 2500. Hope that help.sIf one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum