Not all of the content showing inside of the popup

77 views Asked by At

I have a popup plugin. Whenever i click the link, the things inside element_to_pop_up DIV are written in the popup window. However i added a function which is not appearing in the popup, it is showed outside of it in the main page. Why does that happen? I guess that the dots make this function get echoed but they are out of the element to pop up DIV. How to get over it?

function writecomments($photoid){
echo $photoid;
}

echo "
<div class='element_to_pop_up'>
".writecomments($photoid)."
<img id='stop' src='".$numphotos['link']."' alt='photo' class='photolink' align='middle'>
<form action='main.php' class='commentsform' method='post'>
<textarea rows='8' cols='80' name='comments'></textarea> <br />
<input type='hidden' name='pid' value='".$photoid."'>
<input type='submit' name='send' value='Wyślij'>
</form>
<a class='b-close'></a>
</div>";

}

I am using bpopup plugin

http://dinbror.dk/blog/bPopup/

Source code:

<div class='element_to_pop_up'>
writecomments(302)
<img id='stop' src='upload/Dzuliet_3.jpg' alt='photo' class='photolink' align='middle'>
<form action='main.php' class='commentsform' method='post'>
<textarea rows='8' cols='80' name='comments'></textarea> <br />
<input type='hidden' name='pid' value='302'>
<input type='submit' name='send' value='Wyślij'>
</form>
<a class='b-close'></a>
2

There are 2 answers

0
LetMeLearn123 On

To do it correctly it is needed to use return instead of echo

function writecomments($photoid){
return $photoid;
}
0
Priyank On

Don't echo,just return it :)

function writecomments($photoid){
 return $photoid;
}