Hello,
Below is a form redirect page. When the form is filled out the following will be seen on the redirect page. What I would like to do is hide the echos that aren't filled out.
So, for instance, if the name and company are filled out then I would like the redirect page to look like this:
Name: What ever is typed in
Company: What ever is typed in
Then I would like the other fields to be hidden.
Currently if the name and company are filled in then it looks like this:
Name: What ever is type in
Company: What ever is typed in
Phone:
Email:
Address:
City:
State:
<span class="content"><strong>Name:</strong></span> <span class="contentred"><?php echo $fullname; ?></span><br>
<span class="content"><strong>Company:</strong></span> <span class="contentred"><?php echo $company; ?></span><br>
<span class="content"><strong>Phone:</strong></span> <span class="contentred"><?php echo $phone; ?></span><br>
<span class="content"><strong>Email:</strong></span> <span class="contentred"><?php echo $email; ?></span><br>
<span class="content"><strong>Address:</strong></span> <span class="contentred"><?php echo $address; ?></span><br>
<span class="content"><strong>City:</strong></span> <span class="contentred"><?php echo $city; ?></span><br>
<span class="content"><strong>State:</strong></span> <span class="contentred"><?php echo $state; ?></span><br>
if then state with echo
Moderator: General Moderators
Re: if then state with echo
The if construct can be really helpful if you know what it is. Consider using it to print something only if a condition is true.
Code: Select all
<?php if ($fullname) echo '<span class="content"><strong>Name:</strong></span> <span class="contentred">', $fullname, '</span><br>'; ?>-
tonyledenko
- Forum Newbie
- Posts: 15
- Joined: Thu Sep 11, 2008 4:22 pm
Re: if then state with echo
Thank you, your "if" statement works perfect!