PHP - No More Than 1 Space Next To Each Other
I'm using this to check username's are valid (letters, numbers and spaces):
Code: [Select] if (!preg_match("/^[a-zA-Z0-9 ]+$/", $username)) However, people can use names like "Hello 4" (5 spaces in a row). How would I eliminate this? Is it best to just replace the 5 spaces with 1 or would that confuse users? Is it best to just throw an error up? Can someone change the regex above to fix it or is it more complicated than that? Similar TutorialsI have a table with postcodes in it. At some point some of the codes will be entered with spaces (LA12 5TH) and some without (LA17HU) what i need is a function to check if there is a space, if not - count back 3 characters from the end of the string and insert a space. I don't know which string function to use - looked at pad but that seems to be for either end of string and not the middle - any ideas? Hello, I'm trying to create a sticky form using: Code: [Select] <input name="assignment_name" type = "text" id="assignment_name" <?php if ($_POST && $errors) { echo "value =" . htmlentities($_POST['assignment_name'], ENT_COMPAT, 'UTF-8'); } else {echo "value = $assignment_name";} ?> Code: [Select] /></text> It works if my assignment name is one word; if it's multiple words, it only produces the first word. Any thoughts would be appreciated. Thank you...
Hello Experts,
I am facing an issue that my site's some urls are working fine containing space, So can you help me what is the reason behind it, and how can i fix it. hi all here is my code... Code: [Select] <?php echo "<input name="."button"." type="."submit"." class="."formbutton"." id="."button"." value="."Submit 1"." />"; ?> problem is, i want to display the value of button is Submit space 1 like "Submit 1", but it is display only "Submit" value and blank space and 1 are not display.. someone help me please.... thanks shahid hussnain Hiya all, Final one from me for now! I'm trying to add a space into a string, which is 12 digits long, I need to add a space after character number 7, I've looked at the explode syntax but I'm struggling to find a way of counting 7 chars in and add a space, or split the string in two and then just output them with a space in between (which would be easier I think). Thanks, Jason Hi ; I have problem with search script ; This is code ; $search_form = "<form method='get' action='' ><span class='aktif'>Arama</span><input class='aktif' type='text' name='search' ><input class='aktif' type='submit'></form>"; echo $search_form ; $search = isset($_GET['search']) ? trim($_GET['search']): ''; $a1=(str_replace(' ', '',$search) ); $S1 = ' '; $S2 = ' '; $S3 = ' '; if($search != ''){ // Terimlerin Arama Kısmı $S1 = sprintf("WHERE Tetik_Ref like '%%%s%%' OR ",mysql_real_escape_string($search)); $S2 = sprintf("Marka_Model like '%%%s%%' OR",mysql_real_escape_string($search)); $S3 = sprintf("Orj_P_N like '%%%s%%'",mysql_real_escape_string($search)); } //Verilerin yazdırılma işlemi $main_query = "SELECT * FROM ats_motor $S1 $S2 $S3 "; $count_query = "SELECT COUNT(*) FROM ats_motor $S1 $S2 $S3 ";Orj_P_N column inside Original Part Numbers. Its same of "111 11 111" or "15K 1245 45" etc. When i search exact records work fine. But I search 11111111 nothing found. I search that and find str_replace function. But i cant use that. Cant import. I try change line 8 and 14. it give me error. Can anybody help me ? Thanks. Edited by Seorniyc, 15 May 2014 - 09:55 AM. I have a field that is 30 chars max, and I have the code checking if the string is empty upon submit, though if someone were to make that field spaces only, it will allow it, and run the query and insert the data. if (strlen($_POST['title']) <= (($userhandler->getRights() == 2) ? 100000 : 30) && strlen($_POST['message']) <= (($userhandler->getRights() == 2) ? 100000 : 2000) && !empty($_POST['title']) && !empty($_POST['message']) && $userhandler->getRights() >= 0) { Howdy,
I am trying to create my website responsive. So far so good, but I got this weird white space on the right of my website and the user that is on a device smaller for 800px get a weird scroll bar. You can see it for yourself here, if you shrink the viewport to 800px or less - http://dyulgerova.in...ile_dyulgerova/
Here is my responsive CSS
/* For 800 pixels wide screens, MAX WIDTH. For example, tablets */ @media all and (max-width: 800px){ /* All images */ img {width:15vw;} /* The header */ #header{ background: #ff0000; width:100vw; } #section{ width:100vw; } #SkypeButton_Call_age_of_empires3_1_paraElement{ display:none; } #header_contact{ position: absolute; top: 120px; left: 394px; } #logo{ margin-top:20px; margin-left:0; } .langs{ margin-top:54px; margin-right:50px; } /* The nav bar */ #header #navigation{ width:100vw; height: 6.5vw; position:fixed; top:-15px; background: #000; height:10; } #header #navigation a{ border-left:1px solid #ff0000; } /* Below the header */ #main_div{ width:80vw; } footer{ width:80vw; } }And here is my NON-RESPONSIVE CSS * {margin: 0px; padding: 0px; } body { color: #E0E0E0; font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; background: #9C1C6B; background: -webkit-radial-gradient(center top, circle, rgba(0,0,0,.2), rgba(0,0,0,.4)) fixed no-repeat, -webkit-linear-gradient(#9C1C6B, #CA278C) fixed no-repeat; background: -moz-radial-gradient(center top, circle, rgba(0,0,0,1), rgba(0,0,0,1)) fixed no-repeat, -moz-linear-gradient(#9C1C6B, #CA278C) fixed no-repeat; background: -o-radial-gradient(center top, circle, rgba(0,0,0,1), rgba(0,0,0,1)) fixed no-repeat, -o-linear-gradient(#9C1C6B, #CA278C) fixed no-repeat; background: radial-gradient(center top, circle, rgba(0,0,0,1), rgba(0,0,0,1)) fixed no-repeat, linear-gradient(#9C1C6B, #CA278C) fixed no-repeat; background-size:contain, contain; } a, a:active, a:visited, a:hover{ color: #FFE9E8; } h3 { margin-bottom:20px; } #header a, #header a:active, #header a:visited, #header a:hover{ color: #000; text-decoration:none; } #header{ width:100%; height:100%; background-color:#FFF; border-bottom:#F00 3px ridge; margin-bottom:50px; background-color:#FFF; background: -webkit-linear-gradient(#F3F3F3, #f6f5f3); background: -moz-linear-gradient(#F3F3F3, #f6f5f3); background: -o-linear-gradient(#F3F3F3, #f6f5f3); background: linear-gradient(#F3F3F3, #f6f5f3); } #logo{ margin-left:200px; } #header #section{ color:#000; margin:auto; } #header #navigation{ width:1000px; height:40px; margin:auto; clear:both; } #header #navigation li a{ color:#999; border-bottom:rgba(0,0,0,0) 3px ridge; width:90px; line-height:40px; float:left; text-align:center; font-style:bold; font-weight:bold; transition:all .3s; -webkit-transition:all .3s; } #header #navigation li a:hover{ color:#222; border-bottom:#000 3px ridge; } /* Makes a navigation item bigger when applied the class */ .long_nav{ width: 176px; } footer a, footer a:active, footer a:visited, footer a:hover{ color: #FFF; text-decoration:none; } figure{ width:200px; height:133px; padding:10px; margin:10px; color:#000; text-align:left; font-size:12px; float:left; background: -webkit-radial-gradient(center top, circle, #FFFFFF, #DFDFDF); background: -moz-radial-gradient(center top, circle, #FFFFFF, #F3F3F3); background: -o-radial-gradient(center top, circle, #FFFFFF, #F3F3F3); background: radial-gradient(center top, circle, #FFFFFF, #DFDFDF); } ul { list-style-type: none; } ol { list-style-type: none; } li { margin-top: 10px; } hgroup{ color:#FFF; padding:5px; border-left: #E47297 3px solid; } p { line-height: 180%; } fieldset { border: 0px currentColor; } img { border:0; max-width: 100%; height: auto; / width: 100%; /* Resizes automatically on any devise. */ } input { margin: 10px; padding: 10px; border-radius: 20px; border: 0px currentColor; width: 300px; height: 30px; } textarea { padding: 10px; border-radius: 10px; border: 0px currentColor; margin-top: 5px; } #main_div { background-color:rgba(0,0,0,.01); margin:auto; width:1000px; padding:10px; clear:both; background: -webkit-linear-gradient(rgba(0,0,0,.0), rgba(0,0,0,.02)); background: -moz-linear-gradient(rgba(0,0,0,.0), #f6f5f3); background: -o-linear-gradient(rgba(0,0,0,.0), #f6f5f3); background: linear-gradient(rgba(0,0,0,.0), rgba(0,0,0,.02)); } footer{ color:#CA278C; padding:10px; border-top:#FFF 2px solid; margin-top:20px; width:725px; padding:20px 23%; overflow:hidden; background-color:#000; height:100%; } footer #navigation{ clear:both; } #bgDeco1{ background-color:#000; position:absolute; bottom:30px; right:10px; width:150px; height:150px; border-radius:50% 50%; opacity:.4; transition:all 1s; -webkit-transition:all 1s; } #bgDeco2{ background-color:#000; position:absolute; bottom:145px; right:25px; width:100px; height:100px; border-radius:50% 50%; opacity:.3; transition:all 1.5s; -webkit-transition:all 1.5s; } #bgDeco3{ background-color:#000; position:absolute; bottom:210px; right:75px; width:80px; height:80px; border-radius:50% 50%; opacity:.2; transition:all 2s; -webkit-transition:all 2s; } #bgDeco4{ background-color:#000; position:absolute; bottom:250px; right:75px; width:50px; height:50px; border-radius:50% 50%; opacity:.1; transition:all 2.5s; -webkit-transition:all 2.5s; } #bgDeco5{ background-color:#000; position:absolute; bottom:250px; right:75px; width:75px; height:75px; border-radius:50% 50%; opacity:.25; transition:all 2.5s; -webkit-transition:all 2.5s; } #bgDeco6{ background-color:#000; position:absolute; bottom:250px; right:75px; width:55px; height:55px; border-radius:50% 50%; opacity:.35; transition:all 2.5s; -webkit-transition:all 2.5s; } #SkypeButton_Call_age_of_empires3_1 { float: right; } #div_main { width: 590px; } #skills { font-size: 19px; margin-top: 40px; margin-bottom: 40px; } .portfolio { padding:14px; margin:14px 0; min-height:200px; border-left:#E47297 2px solid; clear:both; cursor:pointer; transition:all .3s; -webkit-transition:all .7s; } .portfolio:hover{ background-color:rgba(255,255,255,.05); } #menu input{ width: 149px; height: 16px; } #menu input[type="submit"]{ padding-bottom: 25px; } #menu form{ height:300px; border:1px solid red; } #menu { margin: 10px; padding: 10px; width: 200px; float: left; } #menu a { font-size: 18px; font-weight: bold; margin-top: 10px; margin-right: 10px; display: block; } #calendar_div { border: 1px solid black; width: 245px; float: left; overflow:hidden; } .buttons { padding-right: 10px; float: right; } #calendar { width: 210px; float: left; overflow:hidden; } #calendar tr > th { color: rgb(0, 0, 0); padding-right: 20px; } #article { padding: 10px; width: 490px; float: left; margin-bottom:40px; border-bottom:2px solid red; } #article p { text-indent: 20px; } #article h1 { border-left:#FFF 2px solid; color:#FFF; background-color:rgba(255,255,255,.15); padding:5px; padding-left:10px; margin:10px 0; } #article h4 { margin: 10px; color: pink; } #comment_form { margin: auto; width: 500px; overflow: hidden; } .comment { background: rgb(167, 211, 241); margin: 10px auto 30px; padding: 10px; border-radius: 10px; border: 1px solid red; width: 500px; height: auto; color: rgb(0, 0, 0); overflow: hidden; } h3.commentator { text-align: left; } #links { width: 400px; margin:auto; } #links li { padding-top: 10px; } .about { width: 1000px; overflow: hidden; } .about img { margin: 10px; overflow: hidden; float: left; } .about p { padding: 10px; } #contact_picture { width:500px; float:right; } #contact_info { float: right; } .red { margin: 10px; padding: 10px; width: 500px; height: auto; overflow: hidden; float: left; } #contact_form { padding: 10px; width: 477px; overflow: hidden; } .secret { display: none; } #uploading { padding: 10px; border: 1px solid red; width: 500px; } .wrong_answer { background: red; padding: 10px; border: 1px solid green; color: white; } .correct_answer { background: green; border: 1px solid orange; } label { display: block; } #secret{ display:none; } /********************************** Blog ***********************************/ #category{ float:right; margin:10px; } /* the class for the flags */ .langs{ float:right; margin:15px; box-shadow: 6px 6px 15px #545454; -webkit-box-shadow: 6px 6px 15px #545454; /* Support for Chrome, Safari, iOS, Android */ -moz-box-shadow: 6px 6px 15px #545454; /* Support for Mozilla -13 */ } /************************************* WP Plugins **************************************/ #single_plugin{ width:590px; margin:10px; border-bottom: 1px solid orange; }And here is my HTML structure for the index.php file <?php include 'html/header.php'; ?> <!-- This ID holds the entire inner container for this page --> <div id="main_div"> <h1>Hello World!</h1> <h3>My name is Stefany and I am from Bulgaria. I am a computer programmer and I create websites and web applications.</h3> <p id="skills"> <strong>Programming languages:</strong> PHP, Perl 5, JavaScript <br /> <strong>Front - end:</strong> HTML5, XHTML, CSS <br /> <strong>Databases:</strong> MySQL, SQLite, MariaDB, MSSQL <br /> <strong>Frameworks:</strong> CodeIgniter <br /> <strong>E-commerce Platforms:</strong> osCommerce, UniqueFree <br /> <strong>Other:</strong> XML, AJAX, JSON <br /> <strong>Web Services:</strong> REST, SOAP <br /> <strong>Content Management Systems:</strong> WordPress, Joomla <br /> I can create forums, blogs, social networks, E - stores, portfolios, WordPress themes, plugin and pretty much any type of website you can think of. <br /> Please take a look at my portfolio below and if you are interested to hire me, please don't hesitate to <a href="contact">contact me!</a> </p> <h2>Portfolio</h2> <div class="portfolio"> <h3><a href="http://tarsis-bg.com/" target="_blank"> Tarsis </a></h3> <a href="http://tarsis-bg.com/" target="_blank"><img src="images/project23.png" width="200" height="133" alt="Company website for selling flats" /></a> <p> Tarsis is a company that builds and sells flats in Sunny Beach, Bulgaria and I made their website on WordPress, including a custom made plugin that was used to build a separate CMS within WP for management of the flats that are for sale. <br /> Technologies used: XHTML, CSS, JavaScript, PHP, MySQL, WordPress </p> </div> <div class="portfolio"> <h3><a href="http://ungerne.dk/" target="_blank"> Ungerne </a></h3> <a href="http://ungerne.dk/" target="_blank"><img src="images/project22.png" width="200" height="133" alt="Web-shop for selling kids' clothes" /></a> <p> Danish web-shop for selling kids' clothes, built on osCommerce. I made major core modifications, such as fixes on the coupon, mail, search, shipping, product and shopping systems. <br /> Technologies used: XHTML, CSS, JavaScript, PHP, MySQL, osCommerce </p> </div> <div class="portfolio"> <h3><a href="http://www.br-electronic.dk/" target="_blank"> Bramming Electronic </a></h3> <a href="http://www.br-electronic.dk/" target="_blank"><img src="images/project21.png" width="200" height="133" alt="Web-shop for selling electronics" /></a> <p> UniqueFree built Danish web-shop for selling electronics. Made core modifications in the shipping system. <br /> Technologies used: XHTML, CSS, JavaScript, PHP, MySQL, UniqueFree </p> </div> <div class="portfolio"> <h3><a href="http://babyfryd.dk/" target="_blank"> BabyFryd </a></h3> <a href="http://babyfryd.dk//" target="_blank"><img src="images/project20.png" width="200" height="133" alt="BabyFryd web-shop for selling kids' clothes" /></a> <p> Another Danish web-shop for selling children's clothes build on UniqueFree <br /> Technologies used: XHTML, CSS, JavaScript, PHP, MySQL, UniqueFree </p> </div> <div class="portfolio"> <h3><a href="http://iskampak.com" target="_blank"> Iskam Pak </a></h3> <a href="http://iskampak.com/" target="_blank"><img src="images/project19.png" width="200" height="133" alt="A website about Angry Birds" /></a> <p> Dating website made entirely from scratch without any frameworks with a custom CMS build into it. <br /> It is currently a work in progress. <br /> Technologies used: XHTML, CSS, JavaScript, PHP, MySQL </p> </div> <div class="portfolio"> <h3><a href="http://angrybirds.me/" target="_blank">Angry Birds </a></h3> <a href="http://angrybirds.me/" target="_blank"><img src="images/project18.png" width="200" height="133" alt="A website about Angry Birds" /></a> <p> A website where you can play the legendary game Angry Birds for free. <br /> I made it with WordPress by tweaking a theme and installing plugins. <br /> Technologies used: XHTML, CSS, WordPress, PHP </p> </div> <div class="portfolio"> <h3><a href="http://dyulgerova.info/nc/index.php" target="_blank"> Wallace & Hull LLP</a></h3> <a href="http://dyulgerova.info/nc/index.php" target="_blank"><img src="images/project17.png" width="200" height="133" alt="Project 12" /></a> <p> The homepage of <strong>"Wallace and Hull LLP"</strong> lawyer firm from Oregon, Washington. It's part of a WordPress theme I made. <br /> Technologies used: HTML5, CSS3, WordPress </p> </div> <div class="portfolio"> <h3><a href="http://www.automirrorsexpress.com/" target="_blank"> Auto Mirrors Express</a></h3> <a href="http://www.automirrorsexpress.com/" target="_blank"><img src="images/project15.jpg" width="200" height="133" alt="Project 12" /></a> <p> E - shop for car mirrors. Created a tag cloud, fixed many DB issues and configured the server. <br /> Technologies used: XHTML, CSS, PHP, JavaScript, Perl, osCommerce </p> </div> <div class="portfolio"> <h3><a href="http://www.autolightcenter.com/index.php" target="_blank"> Auto Lights Center</a></h3> <a href="http://www.autolightcenter.com/index.php" target="_blank"><img src="images/project14.jpg" width="200" height="133" alt="Project 12" /></a> <p> E - shop for car lights. Made some grand changes with the design, the entire back end code and the DB. Greatly increased the security. <br /> Technologies used: XHTML, CSS, PHP, JavaScript, Perl, osCommerce </p> </div> <div class="portfolio"> <h3><a href="http://radiosean.co.uk/"> Radio Sean</a></h3> <a href="http://radiosean.co.uk/"><img src="images/project13.jpg" width="200" height="133" alt="Project 12" /></a> <p> Homepage of a British radio station. I created the search engine of the website. <br /> Technologies used: XHTML, PHP </p> </div> <div class="portfolio"> <h3><a href="/portfolio/otto" target="_blank"> Otto Steininger</a></h3> <a href="http://www.ottosteininger.com/" target="_blank"><img src="images/project12.jpg" width="200" height="133" alt="Project 12" /></a> <p> Coming soon page for the website of an animator/illustrator professional. <br /> Technologies used: XHTML, CSS, Javascript </p> </div> <div class="portfolio"> <h3><a href="http://freepic.eu/" target="_blank"> FreePic</a></h3> <a href="http://freepic.eu/" target="_blank"><img src="images/project11.png" width="200" height="133" alt="Project 11" /></a> <p> Free image hosting website. I created the GIF category, the admin panel and increased the security of the website. <br /> Technologies used: XHTML, CSS, PHP, MySQL, GD </p> </div> <div class="portfolio"> <h3><a href="http://studyingthepast.com/" target="_blank"> Studying The Past</a></h3> <a href="http://studyingthepast.com/" target="_blank"><img src="images/project10.png" width="200" height="133" alt="Project 10" /></a> <p> A website about history. 100% XHTML 1.0 and CSS valid. <br /> Technologies used: XHTML, CSS, PHP, SQLite </p> </div> <!-- The "portfolio" class is a div that holds one website at a time. That's why there are so many declarations of that div --> <div class="portfolio"> <!-- The name of the website in a header element with a link to it --> <h3><a href="http://sundaygolessons.com/" target="_blank">Sunday Go Lessons</a></h3> <!-- And a picture of the website again with a link to it because it's cool to also have a screenshot beside just a super boring link, WOW --> <a href="http://sundaygolessons.com/" target="_blank"><img src="images/project9.png" width="200" height="133" alt="Project 9" /></a> <!-- And a litte explanation as to what the website is the hell about. --> <p> A webshop for selling and renting <a href="https://www.usgo.org/what-go">Go</a> related books and videos, with integrated PayPal payment system. <br /> Technologies used: XHTML, CSS, PHP, MySQL, PayPal </p> </div> <!-- End of the previous website and now it's the turn of the next. The bragging continues... --> <div class="portfolio"> <h3><a href="http://code-forums.info/" target="_blank"> PHP Forum</a></h3> <a href="http://code-forums.info/" target="_blank"><img src="images/project7.png" width="200" height="133" alt="Project 7" /></a> <p> A programming forum coded from scratch, without using any PHP frameworks or ready made stuff. <a href="http://github.com/Stefany93/PHP-Forum">Source code.</a> <br /> Technologies used: XHTML, CSS, PHP, MySQL, JavaScript </p> </div> <div class="portfolio"> <h3><a href="http://dyulgerova.info/project_blog/" target="_blank">Bulgarian newspapper</a></h3> <a href="http://dyulgerova.info/project_blog/" target="_blank"><img src="images/project6.png" width="200" height="133" alt="Project 2" /></a> <p> This project has been made half way and it is currently frozen. <br /> Technologies used: XHTML, CSS, PHP, MySQL, JavaScript </p> </div> <div class="portfolio"> <h3><a href="http://www.bettercitiesforum.com/" target="_blank"> WordPress website about improving neighbourhoods</a></h3> <a href="http://www.bettercitiesforum.com/" target="_blank"><img src="images/project5.png" width="200" height="133" alt="Project 2" /></a> <p> I installed a Simple Machines Forum and made some tweaks on the source code as well on the site. <br /> Technologies used: WordPress, PHP </p> </div> <div class="portfolio"> <h3><a href="big_images/project4.png" target="_blank">Social Network</a></h3> <a href="big_images/project4.png" target="_blank"><img src="images/project4.png" width="200" height="133" alt="Project 2" /></a> <p> Including a forum, an individual learning module and an event calendar. The social network is private for the residents anesthesiologists of the Texas Tech University <br /> and therefore not in the public domain. I created it in twenty days from scratch. <br /> Technologies used: HTML5, CSS, PHP, MySQL, JavaScript. </p> </div> <div class="portfolio"> <h3><a href="http://chrisshilts.com/" target="_blank">Portfolio for a web designer.</a></h3> <a href="http://chrisshilts.com/" target="_blank"><img src="images/project3.jpg" width="200" height="133" alt="Project 2" /></a> <p> Basically I made the blog page with a custom Content Management System including an Admin panel. <br /> Technologies used: PHP, MySQL, JavaScript. </p> </div> <div class="portfolio"> <h3><a href="http://www.borsp.com/sandh/dazer/" target="_blank"> E - Shop</a></h3> <a href="http://www.borsp.com/sandh/dazer/" target="_blank"><img src="images/project2.jpg" width="200" height="133" alt="Project 2" /></a> <p> I made the front - end and my colleague made the back - end. It's in a process of being uploaded. <br /> Techologies used: XHTML, CSS, JavaScript. </p> </div> </div> <?php include 'html/footer.php'; ?>Please help me! I managed to fix the problem with "overflow-x:hidden" property of "body" in CSS, but I do believe this is way too wrong. Edited by Stefany93, 17 June 2014 - 11:06 AM. I want to add a space after $item in the below statement so that there is more space between the output of Item and Qty. Hi guys, does anybody know of any good libraries to handle and validate file uploading including Zipped folders. Also I was needing some tips, so my website developers can come and upload zipped folders, files etc. but eventually would'nt this start taking up a lot of space especially the zipped folders?
I've been using an option that's a state, an example would be South Carolina or North Dekota. In the url the $_GET var turns it into South+Carolina or North+Dekota. Is this common and okay across different Browsers? I've tried ie and firefox and the + sign is addded but I was wondering if they're just designed to be as idiot proof as possible. Thanks I have tried to look google, but was unable to find anything. and the search daemon is giving me errors on this site. So, when I am calling lines from a text file, I am getting a problem. to explain, I will use a # to show were this "white space" is I am getting This is the text file Code: [Select] url.com url2.com url3.com when PHP reads the file, and I output it into PHP its reading it like this Code: [Select] url1.com# url2.com# url3.com url1.com and url2.com both are getting this "white space" at the end of them, and the last entry does not. I have tried to use str_replace(" ","",$line) and str_replace("\r","",$line) but nothing. can anyone advise me as to what character this is that is being outputed. my code I'm using $f = fopen ("list.txt", "r"); while ($line= fgets ($f)) { if($url == $line){echo $line;} } fclose ($f); I'm familiar with 'trim' and even tried the following: $datanew = str_replace(array("\n", "\r", "\t", " ", "\o", "\xOB"), '', $data); but for the life of me I can't remove any white space within the source code which is messing everything else up. This is what I need: What people see.... Code: [Select] word1 word2 word3 The source... Code: [Select] word1 word2 word3 This is the current situation What people see... Code: [Select] word1 word2 word3 The source... Code: [Select] word1 word2 word3 For whatever reason, if I can strip the whitespace from the source code then I can use the content accordingly. How would do you strip the white space? Does this even make sense? The below code returns a radio list after an input box in a profile edit section. All I want to do is add a space at the beginning of the radio list so to separate the input box and the radio list. Where the magic happens here is on this line: return $selhtml . ' ' . getFieldIcons( $_CB_framework->getUi(), $required, null, $fieldHandler->getFieldDescription( $field, $user, $output, $reason ), $fieldHandler->getFieldTitle( $field, $user, $output, $reason ) ); I've tried several variations of trying to use &nspb; both in the return string directly as well as creating a var for it. I've tried various ways of wrapping it in a div to simply add a margin, I've tried kicking my dog, I've tried banging my head against the wall, nothing seems to work. I either get a t var error, an unexpected something or other like . or & error depending on what I'm doing, or it tries to divide by zero using /'s. Here's a larger view of the code: function onFieldIcons( &$fieldHandler, &$field, &$user, $output, $reason, $tag, $type, $value, $additional, $allValues, $displayFieldIcons, $required ) { global $_CB_framework, $ueConfig, $_CB_fieldIconDisplayed; if ( is_object( $field->params ) ) { $privacyLevel = $field->params->get( 'plug_cbprivacy_level' ); } else { $privacyLevel = 0; } if ( $displayFieldIcons && ( $reason != 'search' ) ) { if ( ( $privacyLevel == 1 ) && ( $field->profile != 0 ) ) { $privacy =& moscomprofilerPrivacy::getInstance( $user, 'field', $field->fieldid ); $selected = ( $privacy ? $privacy->rule : '' ); $selectorName = $field->name . '___cbprivacy'; $connTypes = array(); if ( $this->params->get( 'conns_by_type', 0 ) ) { if ( $ueConfig['connection_categories'] ) { $connTypes = explode( "\n", $ueConfig['connection_categories'] ); foreach ( array_keys( $connTypes ) as $k) { $connTypes[$k] = trim( $connTypes[$k] ); } } if ( $selected == 2 ) { $type = $privacy->getParam( 'conn_cat' ); if ( $type ) { $selected = $selected . '|*|' . $type; } } } $options = array(); $options[] = moscomprofilerHTML::makeOption( '', '' . CBTxt::T(' ') ); if ( ( $ueConfig['allow_profileviewbyGID'] == -2 ) && $this->params->get( 'prop_registered', 1 ) ) { $options[] = moscomprofilerHTML::makeOption( '1', '' . CBTxt::T(' ' ) ); } if ( $ueConfig['allowConnections'] ) { $prop_connections = $this->params->get( 'prop_connections', 1 ); if ( $prop_connections ) { $options[] = moscomprofilerHTML::makeOption( '2', '' . CBTxt::T( ' ' ) ); } if ( count( $connTypes ) > 1 ) { foreach ($connTypes as $type ) { $options[] = moscomprofilerHTML::makeOption( '2|*|' . htmlspecialchars( $type ), ( $prop_connections ? ' ⌊ ' : '' ) . '' . sprintf( CBTxt::T( 'Only for %s' ), $type ) ); } } if ( $this->params->get( 'prop_fofs', 1 ) ) { $options[] = moscomprofilerHTML::makeOption( '3', '' . CBTxt::T( 'Also for friends of friends' ) ); } } if ( $this->params->get( 'prop_invisible', 1 ) ) { $options[] = moscomprofilerHTML::makeOption( '99', '' . CBTxt::T( ' ' ) ); } $selHtml = moscomprofilerHTML::radioList( $options, $selectorName, '', 'value', 'text', $selected, 2, false ); if ( isset( $_CB_fieldIconDisplayed[$field->fieldid] ) ) { return $selHtml; } else { $_CB_fieldIconDisplayed[$field->fieldid] = true; return $selHtml . ' ' . getFieldIcons( $_CB_framework->getUi(), $required, null, $fieldHandler->getFieldDescription( $field, $user, $output, $reason ), $fieldHandler->getFieldTitle( $field, $user, $output, $reason ) ); } } else { if ( isset( $_CB_fieldIconDisplayed[$field->fieldid] ) ) { return null; } else { $_CB_fieldIconDisplayed[$field->fieldid] = true; return getFieldIcons( $_CB_framework->getUi(), $required, $field->profile, $fieldHandler->getFieldDescription( $field, $user, $output, $reason ), $fieldHandler->getFieldTitle( $field, $user, $output, $reason ) ); } } } else { return null; } } The basic layout here is this: |inputbox||radio list| But I want: |inputbox| |radio list| HI everyone, Here is my code: Code: [Select] $myFile = "newuser.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 55); fclose($fh); $pices=explode(' ', $theData); And it opens up newuser.txt which is: "I love girls LOL 77" The "I Love GIRLS LOL" is the username of the user and the 77 is the id of the user! But when I echo it out like this: Code: [Select] <a href=".?act=Profile&id='.$pices[1].'">'.$pices[0].'</a> It shows only the letter "i"? How do I make it show the full username even if it has spaces? Hello, is there a way to move one object left to right or right to left without writing 10000 times Thank you How do I make sure that SPACES are allow in a regular expression like this... Code: [Select] if (preg_match('/^[A-Z0-9#&\',.-]{2,30}$/i', $_POST['address1'])){ Thanks, Debbie hey guys thanks for the upcoming support how do I set the blue to fill up the remaining width of the while maininfo div? I tried setting the width:auto <div class="maininfo"> <div class="large">2</div> <div class="smallblock"> <div class="smalltop">3</div> <div class="small">4</div> </div> <div class="smallblock"> <div class="smalltop">5</div> <div class="small">6</div> </div> </div> .maininfo { width: 600px; } .large { float: left; height: 95px; background-color: blue; width:auto; } .smallblock { float: right; height: 90px; margin: 0 0 0 5px; width: 20%; } .small { background-color: red; height: 50%; width: 100%; } .smalltop { background-color: red; height: 50%; width: 100%; margin-bottom:5px; }Edit fiddle - JSFiddle Do I really have to care about the amount of spaces/tabs I have in my program? Is my code good? Example: Code: [Select] class SportListout{ public $start; public $db; private $junk = 'This is junk data. Unable to find it \'s parents. It is recommended that you delete this data.'; function __construct($db){ $this -> db = $db; $this -> setStartingParent(); } function searchListout($sp){ $notif = 'There are no search results that match that criteria.'; if(strlen($sp) > 0){ if(strlen($sp) < 3){ This is my common text format. Is this ok or should I not make spaces in between functions? I'm trying to create a simple data dump to a text file. It was all working fine and now fopen doesn't like my relative paths. So I'm using an absolute path to the file: C:\\Program Files\\FDS\\DTManage\\Web\\DTM\\php\\DTBill\\sources\\snapshot\\snapshot.txt But fopen keeps saying it can't open the file. It's acting like it isn't there. $path_parts = pathinfo(__FILE__); $filename = str_replace('\\', '\\\\', $path_parts['dirname'])."\\\\snapshot.txt"; if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; } Can someone tell me why this isn't working? |