sp@rky13 Posted October 16, 2009 Share Posted October 16, 2009 Ok so i asked a quesstion about a select all button using javascript in this topic. I got the select all bit solved but for some reason I am having problems with the php executing. So before I changed it to a textarea box the line break came across fine but now they don't. The old version which works fine can be found here. But then when I pu use the new version with the select all it ends up like this: [village]490|601[/village]<br>[village]495|600[/village] I don't see what the problem is. I would say it's something to do with textarea but I was sent here. What could be the problem? Extra info: That page has this include: ?php if ($pc=='') include "barbs_include_nopc.php"; else if ($pc=='on') include "barbs_include_pc.php" ?> which in the end leads to a code like this: <?php $yLow = floor($k1 / 10) * 100; $yHigh = $yLow + 99; $xLow = ($k1 % 10) * 100; $xHigh = $xLow + 99; $BetweenClause = "x BETWEEN $xLow AND $xHigh AND y BETWEEN $yLow AND $yHigh"; $con = mysql_connect("********","*******","********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("******", $con); $result = mysql_query("SELECT * FROM village$world WHERE player = '0' AND $BetweenClause AND points <= '$pointsmax'"); while($row = mysql_fetch_array($result)) { echo "[village]".$row['x']."|".$row['y']."[/village]".[b]"<br>";[/b] } mysql_close($con); ?> Thw bolded bit is where the line break should be but with the textarea one it doesn't recognise that as a line break Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/ Share on other sites More sharing options...
mikesta707 Posted October 16, 2009 Share Posted October 16, 2009 looks fine to me. but you may want to try <br /> thats more or less the valid way to do it, since the line break tag is self closing (in XHTML) so the browser may be freaking out about that Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-937835 Share on other sites More sharing options...
sp@rky13 Posted October 16, 2009 Author Share Posted October 16, 2009 thanks for the reply but o that didn't work Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-937839 Share on other sites More sharing options...
trq Posted October 16, 2009 Share Posted October 16, 2009 No idea what your are rambling on about. Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-937863 Share on other sites More sharing options...
sp@rky13 Posted October 16, 2009 Author Share Posted October 16, 2009 Ok, I'll try again. this website out puts something like this: [village]490|601[/village] [village]495|600[/village] then I asked n the forum how to do a select all button. Got that working using this as the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="style.css"/> <title>Create Barb list</title> <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?> <?php $k1 = $_GET["k1"];?> <?php $world = $_GET["world"];?> <?php $pointsmin = $_GET["pointsmin"];?> <?php $pointsmax = $_GET["pointsmax"];?> <?php $p1 = $_GET["p1"];?> <?php $p2 = $_GET["p2"];?> <?php $pc = $_GET["pc"];?> <script type="text/javascript"> window.onload=function() { var target = document.getElementById("target"); target.onfocus = function() { this.select(); } } </script> </head> <body> <div id="wrapper"> <div id="header"> <a href="bbcodebarbs.php"><img src="images/bbcode_title.png" alt="Fake Script Maker" border="0"></a> </div> <div id="navigation"> <div class="container"> <ul id="navPyra"> <li><a href="index.php">Home</a></li> <li><a href="fake_script.php">Fake Script Maker</a></li> <li><a class="active"href="bbcodebarbs.php">BBCoded Barbs</a></li> <li><a href="thanks_central.php">Thanks Central</a></li> <li><a href="support.php">Support</a></li> <li><a href="contact.php">Contact</a></li> </ul> </div> </div> </div> <div id="content"> <textarea id="target" style="margin: 0px; padding: 6px; border: 1px inset; width: 250px; height: 200px; text-align: left; background-color: #FAFAD2 ; overflow: auto"><?php if ($pc=='') include "barbs_include_nopc.php"; else if ($pc=='on') include "barbs_include_pc.php" ?></textarea> <!-- Beginning of Project Wonderful ad code: --> <!-- Ad box ID: 42981 --> <center><script type="text/javascript"> <!-- var pw_d=document; pw_d.projectwonderful_adbox_id = "42981"; pw_d.projectwonderful_adbox_type = "1"; pw_d.projectwonderful_foreground_color = ""; pw_d.projectwonderful_background_color = ""; //--> </script> <script type="text/javascript" src="http://www.projectwonderful.com/ad_display.js"></script> <noscript><map name="admap42981" id="admap42981"><area href="http://www.projectwonderful.com/out_nojs.php?r=0&c=0&id=42981&type=1" shape="rect" coords="0,0,468,60" title="" alt="" target="_blank" /></map> <table cellpadding="0" border="0" cellspacing="0" width="468" bgcolor="#ffffff"><tr><td><img src="http://www.projectwonderful.com/nojs.php?id=42981&type=1" width="468" height="60" usemap="#admap42981" border="0" alt="" /></td></tr><tr><td bgcolor="#ffffff" colspan="1"><center><a style="font-size:10px;color:#0000ff;text-decoration:none;line-height:1.2;font-weight:bold;font-family:Tahoma, verdana,arial,helvetica,sans-serif;text-transform: none;letter-spacing:normal;text-shadow:none;white-space:normal;word-spacing:normal;" href="http://www.projectwonderful.com/advertisehere.php?id=42981&type=1" target="_blank">Your ad could be here, right now.</a></center></td></tr></table> </noscript></center> <!-- End of Project Wonderful ad code. --> </div> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=5190901; var sc_invisible=1; var sc_partition=49; var sc_click_stat=1; var sc_security="2612f13c"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><div class="statcounter"><a title="wordpress stats " href="http://www.statcounter.com/wordpress.com/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/5190901/0/2612f13c/1/" alt="wordpress stats " ></a></div></noscript> <!-- End of StatCounter Code --> </body> </html> But the problem was that instead of it having the result as: [village]490|601[/village] [village]495|600[/village] it ended up like this: [village]490|601[/village]<br>[village]495|600[/village] How can I fix this? Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-937869 Share on other sites More sharing options...
sp@rky13 Posted October 16, 2009 Author Share Posted October 16, 2009 Does anyone know how I could fix this? Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938388 Share on other sites More sharing options...
trq Posted October 16, 2009 Share Posted October 16, 2009 Nope, still no idea what your talking bout I'm afraid. Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938392 Share on other sites More sharing options...
Warz Posted October 16, 2009 Share Posted October 16, 2009 Where you are printing out your list you just have to replace <br> with \n Example: echo "[village]".$row['x']."|".$row['y']."[/village][b]\n[/b]"; Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938401 Share on other sites More sharing options...
sp@rky13 Posted October 17, 2009 Author Share Posted October 17, 2009 ^ That didn't work either lol It came out as this: [village]490|601[/village]/n[village]495|600[/village] Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938426 Share on other sites More sharing options...
Warz Posted October 17, 2009 Share Posted October 17, 2009 /n ? try again with \n Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938429 Share on other sites More sharing options...
Tuck Posted October 17, 2009 Share Posted October 17, 2009 /n ? try again with \n idk if \n works in php do in python but i use \r for new lines in php Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938431 Share on other sites More sharing options...
GoneNowBye Posted October 17, 2009 Share Posted October 17, 2009 \n and \r both represent a linebreak. a linebreak (or carrage return) in HTML is <br /> Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938438 Share on other sites More sharing options...
sp@rky13 Posted October 17, 2009 Author Share Posted October 17, 2009 The \n worked perfectly. Thank you very muchly Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938440 Share on other sites More sharing options...
GoneNowBye Posted October 17, 2009 Share Posted October 17, 2009 np Quote Link to comment https://forums.phpfreaks.com/topic/177866-html-not-executing-with-in-php/#findComment-938547 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.