PHP: Syntax for IF THEN statement to display a form field

Hello.  I know very little about PHP.  I primarily use ASP.  I am, however, having to alter a portion of code on a PHP page.

I need to have an IF THEN statement to display a form field ("Lyme").

The conditional statement is on an "Order Confirmation" page.  There is a form on the "Order" page named "Lyme".  On the "Order Confirmation" page, I would like to basically say:

IF {formfieldfrom ORDER page} is equal to "Y" THEN
Display a paragraph of text
ELSE
Do not display anything


How can I do this?

Thanks so much,
Shane
lshaneAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
if (@$_POST["FORM FIELD NAME"] == "Y")
{
  Display a paragraph of text
}
0
 
lshaneAuthor Commented:
Thanks, angellll.  I appreciate that!

I'll give it a try shortly, but it seems very straightforward.


Thanks again,
Shane
0
 
lshaneAuthor Commented:
One other quick question, please:

Do I need to place delimiters around that code?  (i.e. <?......?>    OR   <? PHP..... ?>    etc.)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes, as that is PHP code.
you should prefer the <?PHP ?> version, as the <? shorttags version is not supported (configured) on all web hostings...
0
 
lshaneAuthor Commented:
Thanks SO much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.