How can I add an IF statement to a .php file

1,940 pts.
Tags:
IF statement
PHP
PHP Coding
Web development
Hi everyone, I have a form that has 6 fields to be filled in by the user. I’m not too good at editing .php files, so I come to you here. Here’s my problem. Fields 1, 2,3,4 and 6 always gets filled in. but sometimes, field 5 will get filled in and if this is the case I need an IF /else statement saying that if field 5 gets filled in then Show fields 5,2,3,4 and 6 as well as Fields 1, 2,3,4 and 6 on the email back to user. I hope this makes sense. Please help. Thank you.

Software/Hardware used:
XP
ASKED: November 12, 2009  8:28 PM
UPDATED: November 14, 2009  2:09 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

<pre>if (<condition>) {
<code>;
} else {
<code>;
}</pre>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TheFinder
    I'm trying to do as you say but keep getting Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/kurt/public_html/forms/bdf/ins_4_pickingupgift.php on line 237 I'm a noob when it comes to .php I'm wanting the letter going to the user to always show fields 1,2,3,,4,6 but is field 5 is filled in then it needs to show also that fields 5,2,3,4,6 so fields 1,2,3,4,6 are always sent back to the user, and if on if 5 gets filled in the user's email would show both 1,2,3,4,6, and 5,2,3,4,6 can you explain a bit more. thank you for your trying.
    1,940 pointsBadges:
    report
  • TheFinder
    I guess the condition would be if field5 was <> "" then email to user = fields 5,2,3.4,6 as well as fields 1,2,3,4,6 I guess, but how do I write that in .php
    1,940 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following