Not all of the content showing inside of the popup

余生长醉 提交于 2019-12-13 04:43:59

问题


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>

回答1:


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

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



回答2:


Don't echo,just return it :)

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


来源:https://stackoverflow.com/questions/27668779/not-all-of-the-content-showing-inside-of-the-popup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!