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.

<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>

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

this should do it.


$array = array(

$html = '';
foreach( $array as $title => $value ) {
        $str = ${$value};
	if ( $str !== '' ) {
		$html .= "<span class=\"content\"><strong>{$title}:</strong>&nbsp;</span>\n";
		$html .= "<span class=\"contentred\">{$str}</span><br />\n";

echo $html;


i know theres another way to do it but i can't think of it right now.