| Author |
Simple php form Help
|
|
| Juan Antonio Villa 2006-03-22, 6:58 pm |
| Hello All. I'm a newbie in programming and I was wondering if I could get
some help from you.
I have a form with the following fields:
-------------------------------------------------
Name
Email
Age (option field) -> over 45 or under 45
Sex (option field) -> male or female
Comments:
-------------------------------------------------
I currently submit this form to Formmail.cgi (Im sure you're familiar with
it) and I get it in an email.
What I need to do is that IF:
- Age is Over 45 and sex is male then send "this" via email to the <email>
field and i want to receive an email with the results of the form.
- Age is Under 45 and sex is male then send "this" via email to the <email>
field and i want to receive an email with the results of the form.
- Age is Over 45 and sex is female then send "this" via email to the <email>
field and i want to receive an email with the results of the form.
- Age is Under 45 and sex is female then send "this" via email to the
<email> field and i want to receive an email with the results of the form.
Could you give me a hint on how to acomplish this using PHP?
Thank you very much!
Juan
| |
| bobzimuta 2006-03-22, 6:58 pm |
| Please, read the documentation on forms
http://us2.php.net/manual/en/tutorial.forms.php
As a hint you will need to access elements of the $_POST array. Such as
$_POST['age'] and $_POST['sex'].
When I'm stuck, I use the following to show all the post data that has
been submitted
if( isset( $_POST ) && !empty( $_POST ) )
{
exit( "<pre>" . print_r( $_POST, true ) . "</pre>" );
}
else
{
exit( "POST is empty, submit a form" );
}
| |
|
|
|
|
| Duderino82 2006-03-23, 7:58 am |
| Can't you just manage the if-then-else by yourself in php and then use
the mail() function???so easy so simple!
|
|
|
|