I am having a problem converting a div to a php variable. This works great as a div but I need to implement this into my php script to show this if the user is viewing another uses page this will display.
//Check to see if you are tracking this member.
$sqlFollow = mysql_query("SELECT * FROM follow WHERE follower_id= " .$id. " and myMember = " .$viewerID . " LIMIT 1");
$numTrack = mysql_num_rows($sqlFollow);
if ($numTrack < 1) {
$divValue = "Track This Person";
$onclick = "trackMember";
}
else {
$divValue = "Don't Track Person";
$onclick = "donttrackMember";
};
$display_tracking_option = '<div class="track_btn_div" id="addremoveTrack"><a href="javascript:;" onclick="'. $onclick.'"("'.$id.'","'.$viewerID.'");"><span class="follow_b">'.$divValue.'</span></a></div>';
Saving this in PHP as a value I am having trouble with the ” vs ‘.
$display_tracking_option = '<div class="track_btn_div" id="addremoveTrack"><a href="javascript:;" onclick="'. $onclick ."(\''. $id .'\',\''. $viewerID .'\');"><span class="follow_b">"'.$divValue.'"</span></a></div>';
You are adding the stuff to a variable using php so you don’t need to echo anything:
Simply concatenate the string.
Alternatively you could use
sprintf():Another thing: why do you have inline stuff?