Davie33 Posted August 16, 2011 Share Posted August 16, 2011 Hi am trying to make a popup for a page called smiley.php.I cant get the popup to work anyone got any idea's ? please. this is the function that i have in inc.php <script type="text/javascript"> function popup(url) { popupWindow = window.open( url,'popUpWindow','width=400,height=400,left=10,top=10,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes') } </script> this is the topic page where the form is topic.php. <?php $query = yasDB_select("SELECT * FROM topic WHERE userid = '$id' ORDER BY id DESC LIMIT 5"); if($query->num_rows == 0) { ?> <div id="memberstext">This topic has no comments, be the first to add one!</div> <?php } else { while($row = $query->fetch_array(MYSQLI_ASSOC)) { $text = $row['comment']; $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />',$text); $text = str_replace(':?','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/confused.gif" title="confused" alt="confused" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cool.gif" title="cool" alt="cool" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cry.gif" title="cry" alt="cry" />',$text); $text = str_replace(':shock:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/eek.gif" title="eek" alt="eek" />',$text); $text = str_replace(':evil:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/evil.gif" title="evil" alt="evil" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/lol.gif" title="lol" alt="lol" />',$text); $text = str_replace(':x','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/mad.gif" title="mad" alt="mad" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/stlyes/images/smileys/razz.gif" title="razz" alt="razz" />',$text); $text = str_replace(':oops:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/redface.gif" title="redface" alt="redface" />',$text); $text = str_replace(':roll:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/sad.gif" title="sad" alt="sad" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/smile.gif" title="smile" alt="smile" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/surprised.gif" title="surprised" alt="surprised" />',$text); $text = str_replace(':twisted:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/twisted.gif" title="twisted" alt="twisted" />',$text); $text = str_replace(':wink:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/wink.gif" title="wink" alt="wink" />',$text); ?> <div class="member_comment_box2"> <div class="commentbox1"><?php echo $row['name'];?></div> <?php echo $text;?></div> <?php } } ?> <form name="addcomment" method="post" action=""> <strong>Message:</strong><br /> <textarea name="comment" rows="3" cols="40" id="comment_message"></textarea><br /> <input name="userid" type="hidden" value="<?php echo $id;?>" /> <input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" /> </center> <!-- start of smiles --> <div id="smiles"><center> <a href="javascript:popup('<?php echo $siteurl;?>smiley.html');">Smiley's</a> <input name="name" type="hidden" value="<?php echo $_SESSION['user'];?>" /><br /> <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" /> </form> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/244877-php-javascript-help-please/ Share on other sites More sharing options...
MasterACE14 Posted August 16, 2011 Share Posted August 16, 2011 you seem to be missing a single quote at the start of status=yes': <script type="text/javascript">function popup(url) { popupWindow = window.open( url,'popUpWindow','width=400,height=400,left=10,top=10,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status='yes')}</script>() Please use the forums [ code ] [ / code ] tags in future posts, thanks. <script type="text/javascript">function popup(url) { popupWindow = window.open( url,'popUpWindow','width=400,height=400,left=10,top=10,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes')}</script>() <?php $query = yasDB_select("SELECT * FROM topic WHERE userid = '$id' ORDER BY id DESC LIMIT 5"); if ($query->num_rows == 0) { ?><div id="memberstext">This topic has no comments, be the first to add one!</div><?php } else { while ($row = $query->fetch_array(MYSQLI_ASSOC)) { $text = $row['comment']; $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />', $text); $text = str_replace(':?', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/confused.gif" title="confused" alt="confused" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cool.gif" title="cool" alt="cool" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cry.gif" title="cry" alt="cry" />', $text); $text = str_replace(':shock:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/eek.gif" title="eek" alt="eek" />', $text); $text = str_replace(':evil:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/evil.gif" title="evil" alt="evil" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/lol.gif" title="lol" alt="lol" />', $text); $text = str_replace(':x', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/mad.gif" title="mad" alt="mad" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/stlyes/images/smileys/razz.gif" title="razz" alt="razz" />', $text); $text = str_replace(':oops:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/redface.gif" title="redface" alt="redface" />', $text); $text = str_replace(':roll:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/sad.gif" title="sad" alt="sad" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/smile.gif" title="smile" alt="smile" />', $text); $text = str_replace('', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/surprised.gif" title="surprised" alt="surprised" />', $text); $text = str_replace(':twisted:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/twisted.gif" title="twisted" alt="twisted" />', $text); $text = str_replace(':wink:', '<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/wink.gif" title="wink" alt="wink" />', $text); ?> <div class="member_comment_box2"> <div class="commentbox1"><?php echo $row['name']; ?></div> <?php echo $text; ?></div><?php } } ?> <form name="addcomment" method="post" action=""><strong>Message:</strong><br /> <textarea name="comment" rows="3" cols="40" id="comment_message"></textarea><br /> <input name="userid" type="hidden" value="<?php echo $id; ?>" /> <input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" /> </center> <!-- start of smiles --> <div id="smiles"><center> <a href="javascript:popup('<?php echo $siteurl; ?>smiley.html');">Smiley's</a><input name="name" type="hidden" value="<?php echo $_SESSION['user']; ?>" /><br /> <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" /> </form><?php } ?>() Quote Link to comment https://forums.phpfreaks.com/topic/244877-php-javascript-help-please/#findComment-1257922 Share on other sites More sharing options...
Davie33 Posted August 16, 2011 Author Share Posted August 16, 2011 I fixed me tags for code sry about that.I have tryed the code and still cant get it to work.Here is full code of topic.php that am still working on if u use notpad++ then go to line 116 thats the link to click on for the popup it should give me the popup page. topic.php <div id="topicwrapper"> <div id="left"> <div id="topic_header"><div id="back"><a href="javascript:history.go(-1)">Go Back</a></div><div id="topic"><?php $id = yasDB_clean($_GET['id']); $query = yasDB_select("SELECT * FROM `blog` WHERE id = '$id'",false); $row = $query->fetch_array(MYSQLI_ASSOC); $blog = $row['topic']; echo '<b>Topic - '.$blog.'</b>'; $query->close(); ?></div><div id="forward"><a href="javascript:history.go(+1)">Go Forward</a></div></div> <div id="topicbox"> <?php if(!isset($_SESSION["user"])) { $user=$_SESSION["user"]; $id=$_SESSION["userid"];?> <div id="reg">You must Register or log in to view this topic.</div> <?php } else { if(isset($_POST['addcomment'])) { if(empty($_POST['userid'])) { ?> <div id="invalid">Sorry, the topic you were commenting seems to be invalid.</div> <?php } elseif(empty($_POST['comment']) || empty($_POST['name'])) { ?> <div id="empty">Please go back and try again, it seems the comment or name was left empty.</div> <?php } else { $userid = yasDB_clean($_POST['userid']); $comment = yasDB_clean($_POST['comment'],true); $name = yasDB_clean($_POST['name']); $ipaddress = $_SERVER['REMOTE_ADDR']; yasDB_insert("INSERT INTO `topic` (userid, comment, ipaddress, name) values ('{$userid}', '{$comment}', '{$ipaddress}', '{$name}')",false); ?> <div id="comment_added">Comment added!</div> <?php } } $id = yasDB_clean($_GET['id']); $rquery = yasDB_select("SELECT `username` FROM `user` ORDER BY `plays` DESC",false); $ranking = array(); $i=0; while ($cow = $rquery->fetch_array(MYSQLI_ASSOC)) { $ranking[$i] = $cow['username']; $i++; } $query = yasDB_select("SELECT * FROM `user` WHERE id = '$id'"); $row = $query->fetch_array(MYSQLI_ASSOC); $query->close(); $joined = date('m/d/y',$row['date']) ; $points = $row['plays']*50; $rank = array_search($username,$ranking)+1; if ( $row['useavatar'] == '1' ) { $avatarimage = $siteurl . 'avatars/' . $row['avatarfile']; } else { $avatarimage = $siteurl . 'avatars/useruploads/noavatar.jpg'; } $id = yasDB_clean($_GET['id']); $query = yasDB_select("SELECT * FROM `blog` WHERE id = '$id'",false); $row = $query->fetch_array(MYSQLI_ASSOC); $query->close(); $blog = $row['text']; $blog = $row['topic']; ?> <div id="blog"><?php echo $row['text'];?><div id="facebook_2"> <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($url);?>&layout=standard&show_faces=true&width=500&action=like&font=lucida+grande&colorscheme=light&height=28" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:28px;" allowTransparency="true"></iframe> </div></div> <div id="stats">Username:<?php echo $row['username'];?><br> <img src="<?php echo $avatarimage;?>" height="100" width="100"> <div id="rank">Rank:<?php echo $rank ;?></div></div> <div class="clear"></div> <?php $query = yasDB_select("SELECT * FROM topic WHERE userid = '$id' ORDER BY id DESC LIMIT 5"); if($query->num_rows == 0) { ?> <div id="memberstext">This topic has no comments, be the first to add one!</div> <?php } else { while($row = $query->fetch_array(MYSQLI_ASSOC)) { $text = $row['comment']; $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/biggrin.gif" title="biggrin" alt="biggrin" />',$text); $text = str_replace(':?','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/confused.gif" title="confused" alt="confused" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cool.gif" title="cool" alt="cool" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/cry.gif" title="cry" alt="cry" />',$text); $text = str_replace(':shock:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/eek.gif" title="eek" alt="eek" />',$text); $text = str_replace(':evil:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/evil.gif" title="evil" alt="evil" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/lol.gif" title="lol" alt="lol" />',$text); $text = str_replace(':x','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/mad.gif" title="mad" alt="mad" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/stlyes/images/smileys/razz.gif" title="razz" alt="razz" />',$text); $text = str_replace(':oops:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/redface.gif" title="redface" alt="redface" />',$text); $text = str_replace(':roll:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/rolleyes.gif" title="rolleyes" alt="rolleyes" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/sad.gif" title="sad" alt="sad" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/smile.gif" title="smile" alt="smile" />',$text); $text = str_replace('','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/surprised.gif" title="surprised" alt="surprised" />',$text); $text = str_replace(':twisted:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/twisted.gif" title="twisted" alt="twisted" />',$text); $text = str_replace(':wink:','<img src="' . $siteurl . 'templates/' . $setting['theme'] . '/styles/images/smileys/wink.gif" title="wink" alt="wink" />',$text); ?> <div class="member_comment_box2"> <div class="commentbox1"><?php echo $row['name'];?></div> <?php echo $text;?></div> <?php } } ?> <form name="addcomment" method="post" action=""> <strong>Message:</strong><br /> <textarea name="comment" rows="3" cols="40" id="comment_message"></textarea><br /> <input name="userid" type="hidden" value="<?php echo $id;?>" /> <input type="hidden" name="timestamp" id="timestamp" value="<?php echo time(); ?>" /> </center> <!-- start of smiles --> <div id="smiles"><center> <a href="javascript:popup('<?php echo $siteurl;?>smiley.html');">Smiley's</a> <input name="name" type="hidden" value="<?php echo $_SESSION['user'];?>" /><br /> <input name="addcomment" type="submit" value="Add Comment" style="border: 1px solid #000; margin-top: 2px;" /> </form> <?php } ?> </div> </div> <div class="clear"></div> </div> <?php include 'column_three.php'; $mysqli->close(); ?> This is the popup page smiley.php <div id="smiles"><center> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/biggrin.gif" border="0" /></a> <a href="javascript:addsmilie(' :? ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/confused.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/cool.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/cry.gif" border="0" /></a> <a href="javascript:addsmilie(' :shock: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/eek.gif" border="0" /></a> <a href="javascript:addsmilie(' :evil: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/evil.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/lol.gif" border="0" /></a> <a href="javascript:addsmilie(' :x ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/mad.gif" border="0" /></a><br /> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/razz.gif" border="0" /></a> <a href="javascript:addsmilie(' :oops: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/redface.gif" border="0" /></a> <a href="javascript:addsmilie(' :roll: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/rolleyes.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/sad.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/smile.gif" border="0" /></a> <a href="javascript:addsmilie(' ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/surprised.gif" border="0" /></a> <a href="javascript:addsmilie(' :twisted: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/twisted.gif" border="0" /></a> <a href="javascript:addsmilie(' :wink: ')"><img src="<?php echo $siteurl;?>templates/<?php echo $setting['theme'];?>/styles/images/smileys/wink.gif" border="0" /></a></center> </div> Quote Link to comment https://forums.phpfreaks.com/topic/244877-php-javascript-help-please/#findComment-1257931 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.