Sorry i really don’t know how to code in PHP but i need to create a popup from picture(button) with the code provided below! It could also be a reveal inviter box too … but it needs to stay the same (not the Facebook inviter box)
if(count($user_data)>0) {
$user = get_users(array('fb_user_id'=>$user_data['id']));
$invited_ids = $user[0]['invited_ids'];
$invited_ids_tab = json_decode($invited_ids, true);
$nb_invited_friends = count($invited_ids_tab);
//page header
echo '<img src="'.$user_data['picture'].'" style="width:36px; vertical-align:middle; margin-right:10px; margin-bottom:10px;">';
echo '<b>Bienvenue '.$user_data['name'].'</b> (<a href="#" id="fb_box_fb_logout_btn">Déconnection</a>) - ';
if(count($user)>0) echo 'Nombre d\'amis invité <b>'.$nb_invited_friends.'</b>';
else echo 'You didn\'t invite any friend yet.';
echo ' - <a href="./content.php">Voir les coupons disponible </a>';
echo '<hr><br>';
//display inviter
$inviter = displayInviter();
echo $inviter;
}
else {
echo '<a href="#" id="fb_box_fb_login_btn" class="facebook16">Connect with Facebook</a>, Invite your friends and Unlock your reward !';
}
?
What i want in a popup is
$inviter = displayInviter();
echo $inviter;
Thank you
PHP can’t make popups by itself, because once the page renders, PHP shuts down, so to speak.
What you’ll need is Javascript, the easiest way would be to use jQuery’s ajax method to call the PHP page with the code you provided, load the code output into a hidden
divelement and then make it pop up using the fadeIn method, for example.Or, if you want to keep the code within the same page, do the same as above, only instead of using the load() function, just echo the popup content into the hidden div.
Simple example:
HTML/PHP
JS function