By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,012 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,012 IT Pros & Developers. It's quick & easy.

Simple php form Help

P: n/a
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
Mar 22 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" );
}

Mar 22 '06 #2

P: n/a
JDS
On Wed, 22 Mar 2006 13:53:52 -0500, Juan Antonio Villa wrote:
I currently submit this form to Formmail.cgi (Im sure you're familiar with
it) and I get it in an email.


Why are you so sure?

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Mar 22 '06 #3

P: n/a
JDS
On Wed, 22 Mar 2006 13:53:52 -0500, Juan Antonio Villa wrote:
Could you give me a hint on how to acomplish this using PHP?

Thank you very much!

Juan


Sorry, but this is too broad a question to answer here.

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Mar 22 '06 #4

P: n/a
Can't you just manage the if-then-else by yourself in php and then use
the mail() function???so easy so simple!

Mar 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.