?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?PHP - variables receiving data from a form / If statement
Author:??(4.10.134.---)
Date:???01-15-04 08:33

I am new at using PHP. This is a really simple question that I just can't see.

I am simply trying to use an echo statement with a variable that receives data from a form. I am also trying to utilize the if statement. At this point, I'm only entering numerical data for the Age response.

The form either respond with "You are not a teenager and like ."

Or, the form responds with:
>?php if ($data1 > 12 && $data1 < 20) { echo("You are a teenager and like " . $data2); } else { echo("You are not a teenager and like " . $data2); } ?>

In both cases, it doesn't evaluate data from $data1, nor does it include data from $data2.


What am I missing?
Help?



Here is my form:



Conditional Statements




Age:

Activity:











Here is my Php form:



Conditional Statements




>?php

if ($data1 > 12 && $data1 < 20) {
echo("You are a teenager and like " . $data2);

} else {
echo("You are not a teenager and like " . $data2);
}


?>


?Re: PHP - variables receiving data from a form / If statement
Author:??(---.ym.rnc.net.cable.rogers.com)
Date:???01-15-04 12:40

New versions of php use $_POST or $_GET to access form data

try this:

if ($_POST['data1'] > 12 && $_POST['data1'] < 20) {
echo("You are a teenager and like " . $_POST['data2']);
} else {
echo("You are not a teenager and like " . $_POST['data2']);
}

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum