Jump to content

Recommended Posts

I have this php code for echoing an address of my member.  Certain arts of the address are not always there

 

<?php if($TheClub['addressL1']!==NULL) { echo "<li>{$TheClub['addressL1']}</li>"; } 
		if($TheClub['addressL2']!==NULL) { echo "<li>{$TheClub['addressL2']}</li>"; } 
		if($TheClub['addressL3']!==NULL) { echo "<li>{$TheClub['addressL3']}</li>"; } 
		 echo "<li>{$TheClub['area']}</li>"; 
		 echo "<li>{$TheClub['county']}<?li>"; 
		echo "<li>{$TheClub['country']}</li>"; 
					echo "<li>{$TheClub['postcode']}</li>";
	 ?>

 

the code works fine in crome and all other browsers it looks like so

 

 

addressL1

addressL2

addressL3

area

county

country

postcode

 

In IE however lets say addressL2 and area was missing it shows with nasty line spaces like so

 

addressL1

 

addressL3

 

county

country

postcode

 

Is there a way of stopping this?  Ive tried using an else { } but that has not solved the issue.  Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/238706-nasty-ie-7-issues/
Share on other sites

Instead of using "!== NULL", try using "!= ''" in your code:

<?php
if($TheClub['addressL1'] != '') { echo "<li>{$TheClub['addressL1']}</li>"; } 
if($TheClub['addressL2'] != '') { echo "<li>{$TheClub['addressL2']}</li>"; } 
if($TheClub['addressL3'] != '') { echo "<li>{$TheClub['addressL3']}</li>"; } 
echo "<li>{$TheClub['area']}</li>"; 
echo "<li>{$TheClub['county']}<li>"; 
echo "<li>{$TheClub['country']}</li>"; 
echo "<li>{$TheClub['postcode']}</li>";
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/238706-nasty-ie-7-issues/#findComment-1226640
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.