Results 1 to 3 of 3

Thread: [RESOLVED] Conditional statement help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Resolved [RESOLVED] Conditional statement help

    i have a report that i have addresses and in the report i print to screen the words "Map It" instead of the address thats a link to google maps so the user can get a map. below is what i use

    Code:
    <td><font size="1" face="Arial, Helvetica, sans-serif"><a href="http://maps.google.com/maps?f=q&hl=en&q=<?php echo urlencode($address); ?>" target="_blank">map it</a></font></td>
    it works great but it does it even when there is no address in a record.

    i have tried a few different if statements with no luck. any help. also would like to know if i could highlight the cell in yellow if blank.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Conditional statement help

    PHP Code:
    <?php if(!empty($address)): ?>
    <td><font size="1" face="Arial, Helvetica, sans-serif"><a href="http://maps.google.com/maps?f=q&hl=en&q=<?php echo urlencode($address); ?>" target="_blank">map it</a></font></td>
    <?php else: ?>
    <td bgcolor="#f00">&nbsp;</td>
    <?php endif; ?>
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Re: Conditional statement help

    Kows,
    worked great.

    thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width