Ok... I am pulling "tooltips" from a database, getting the
$name and $tip
then I am writing a function called tooltip to generate a link in pieces, so that when I want to display a tooltip link i just put:
<? tooltip('Name'); ?>
The problem I am having is matching the right 'Name' in the function with what's in my array. It's frustrating the heck out of me. See code:
dbConnect('mindev');
$sql = "SELECT * FROM tooltip WHERE cat='$catID'";
$result = mysql_query($sql);
if (!$result) {
echo "Unable to get tooltips from database.<br>";
echo mysql_error();
exit;
}
while ($row = mysql_fetch_array($result)) {
$name = $row['name'];
$tip = $row['tip'];
$ttip["$name"] = "$tip";
}
// Build Link
function tooltip($tipname) {
global $ttip;
// global $name;
// global $tip;
while (list($name,$tip) = each($ttip)) {
if ($name == $tipname) {
echo "<a href=\"images/clear.gif\" onclick=\"return wrapContent(event, this.href, 0, 0, '"
. "<b>" . $tipname . "</b><br>" . htmlspecialchars($ttip[$name]) .
"', 300)\">";
}
}
}