Help - Search - Members - Calendar
Full Version: IF Then statements
HTMLHelp Forums > Programming > Server-side Scripting
MS35
Hi, i'm new to the forum and to web design.

I've created .PHP page with an input form of which one set is a radio group.

The Radio group returns the variable PPRet with a value of 1, 2 or 3 depending on which button has been selected.

The value is then submitted (post) and available on the next page and I can check the right values are there with:

<p><font face="Arial, Helvetica, sans-serif" size="3">Check value of radio button:</font><font face="Arial, Helvetica, sans-serif" size="3"><?php echo $_POST['PPRet']; ?></font></p>

If I now want to use the value to return different text depending on the value, what code would i use?

I've tried various versions of If statement but none seem to work - apologies but this must seem really basic and I'm presuming the code I need is just simple HTML rather than Javascript (or anything else)

For an example i'd be happy with text of 1 = Yes, 2 = no, 3 = Don't mind - so I can change the text later.

Thanks
pandy
QUOTE
I've tried various versions of If statement but none seem to work - apologies but this must seem really basic and I'm presuming the code I need is just simple HTML rather than Javascript (or anything else)


HTML isn't a programming language. It's a mere markup langue. There are no conditional statements or anything else like that.
Brian Chandler
QUOTE(pandy @ Nov 11 2007, 11:21 PM) *

QUOTE
I've tried various versions of If statement but none seem to work - apologies but this must seem really basic and I'm presuming the code I need is just simple HTML rather than Javascript (or anything else)


HTML isn't a programming language. It's a mere markup langue. There are no conditional statements or anything else like that.


Which is true, of course, but the OP is trying to use PHP, which is a programming language.

Try the php manual for 'case statement'.

And get out of the habit of thinking of php as little squibbits of "code" that fit inside a bit of html.

<?
Start some php program
...
and do some wild things with it
...
including echo-ing useful bits to the page you are generating.
...
Then if, while, and that stuff should come naturally.

?>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.