*

Recent

Author Topic: Undefined variable: mylinks  (Read 3260 times)

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Undefined variable: mylinks
« on: November 02, 2014, 06:32:04 PM »
Notice: Undefined variable: mylinks in C:\xampp\htdocs\fas3\templates\tiles\showprofile.php on line 68

I can't sort of get around this.

There's two arguments for the one VAR - If it's not empty - DO THIS - else DO THIS?  ;)

Code: [Select]
if ($link1 != '') {$mylinks .= '<a href=\'http://'.$link1.'\' target=\'_blank\'>'.$link1.'</a><br>';}else{$mylinks = '';};
if ($link2 != '') {$mylinks .= '<a href=\'http://'.$link2.'\' target=\'_blank\'>'.$link2.'</a><br>';}else{$mylinks = '';};
if ($link3 != '') {$mylinks .= '<a href=\'http://'.$link3.'\' target=\'_blank\'>'.$link3.'</a><br>';}else{$mylinks = '';};
if ($link4 != '') {$mylinks .= '<a href=\'http://'.$link4.'\' target=\'_blank\'>'.$link4.'</a><br>';}else{$mylinks = '';};
if ($link5 != '') {$mylinks .= '<a href=\'http://'.$link5.'\' target=\'_blank\'>'.$link5.'</a><br>';}else{$mylinks = '';};
if ($link6 != '') {$mylinks .= '<a href=\'http://'.$link6.'\' target=\'_blank\'>'.$link6.'</a><br>';}else{$mylinks = '';};
if ($link7 != '') {$mylinks .= '<a href=\'http://'.$link7.'\' target=\'_blank\'>'.$link7.'</a><br>';}else{$mylinks = '';};
if ($link8 != '') {$mylinks .= '<a href=\'http://'.$link8.'\' target=\'_blank\'>'.$link8.'</a>';};

All it needs to be is:

Code: [Select]
if ($link1 != '') {$link1 = '<a href="http://'.$link1.'" target="_blank">'.$link1.'</a><br />';}
if ($link2 != '') {$link2 = '<a href="http://'.$link2.'" target="_blank">'.$link2.'</a><br />';}
if ($link3 != '') {$link3 = '<a href="http://'.$link3.'" target="_blank">'.$link3.'</a><br />';}
if ($link4 != '') {$link4 = '<a href="http://'.$link4.'" target="_blank">'.$link4.'</a><br />';}
if ($link5 != '') {$link5 = '<a href="http://'.$link5.'" target="_blank">'.$link5.'</a><br />';}
if ($link6 != '') {$link6 = '<a href="http://'.$link6.'" target="_blank">'.$link6.'</a><br />';}
if ($link7 != '') {$link7 = '<a href="http://'.$link7.'" target="_blank">'.$link7.'</a><br />';}
if ($link8 != '') {$link8 = '<a href="http://'.$link8.'" target="_blank">'.$link8.'</a>';};