Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tool Tips are Being Cut Short 1

Status
Not open for further replies.

6kleg

IS-IT--Management
Dec 21, 2004
24
US
I'm pulling data from a mySQL database into a php array to display a list of events using fields named event_date and event_name and event_description. For each record in which the event_description field is NOT empty, the PHP should wrap the event_name in a set of <a> and </a> tags and set the anchor's title attribute to be the event_description, so that mouse over the event_name shows a Tool Tip with the full description of the event.

The php is delivering the page properly except that the every Tool Tip only shows the first word in the event_description field.

Any ideas why this might be happeneing?
 
it's hard to say. can you show the code? maybe there are weird characters or something coming through...
 
I'll bet dollars to donuts you're just not quoting it properly.

Check the source of the output page, if it reads ...
Code:
<a href="[URL unfurl="true"]www.google.com"[/URL] title=Take me to google>GOOGLE</a>

Then the tooltip will only display Take
 
I think skiflyer is on the right track.

Here's the code:
Code:
    if (!empty($row['event_descr'])){
    echo '<a title=' . $row['event_descr'] . '><u>';
    }
    echo $row['event_name'];
    
    if (!empty($row['event_descr'])){
    echo '</u></a>';
    }

How should I do the quotes so that they cover the event_description field?
 
Code:
if (!empty($row['event_descr'])){
      echo '<a title=[red]"[/red]' . $row['event_descr'] . '[red]"[/red]><u>';
    }
    echo $row['event_name'];
    
    if (!empty($row['event_descr'])){
      echo '</u></a>';
    }

You actually want to do a
Code:
htmlentities($row['event_descr'])

in place of your $row['event_descr']

Otherwise it would be incredibly easy for people to toy with your site.
 
skiflyer,

The quotes fixed the tool tip problem. Thanks (with a star).

Please explain more about the htmlentities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top