PHP - ? Character In Link
I have problem, there are users with "?" character in username, and their address to profile is /profile/username/.
I have var: $username that is that username, now, how can i replace all that characters which cant open users profile.. I mean for "?" i need to put "%3F", how can i replace? I know with str_replace, but is there any other solution like htmlencode or something like that? :S Similar TutorialsI know via firebug that the correct parameters were passed to my process page and the parameter being passed that in caused issues on the process page is $characterIDList. What's causing the issue is that its not inserting the value into the insert query. The rest of the insert query works fine. process page $characterIDs = explode(',', $_POST['characterIDList']); foreach($characterIDs as $itm){ $id = (int)$itm; } $defaultcharid = (int)$characterIDs[0]; $query = "INSERT INTO `handlers` (username, password, firstname, lastname, email, status_id, isadmin, default_character_id, creator_id, datecreated) VALUES ('$username','$password','$firstname','$lastname','$email','$status','$admin', '$defaultcharid', 1, NOW())"; Hi, does anybody know why I get a question mark inside a diamond shape where a pound sign should be when i retrieve data from a mysql database? I have tried using latin1_general_ci and utf8_general_ci and they both do the same, don't know whether that is anything to do with it or not? Any help would be greatly appreciated. I got another problem. It is a counting characters. When I reload text from database, I want to count how many characters are in text. The problem is that I use the timymce, and there is a tags </p> and formats <span> and other formats. How can I count characters without those format, just pure characters entire text? I need a php code. And some plus - text is in utf8 coding in database with utf8 bin. Can someone help me with this. I think I need to use substr: how do I only echo out everything after the period ( ".") for example if I have "table.birthday" I want to echo: "birthday" Hey, I'm having an issue with using Wikipedia's OpenSearch API - it sometimes gives me characters in a unicode format: "\u00f1" and I would like to convert back into a correctly displayed format (in this case, n-tilde; spanish n). Any suggestions? all i want is for when their is a _ to be replaced with a space so i tried these and neither worked Code: [Select] <?php $pmod = str_replace("_"," ",$p); $pmod = preg_replace("_"," ",$p); ?> so i was wondering if because this was in a while statement, is this the reason its not working, and if so how should i fix it (this is the while) Code: [Select] <?php while ($z <= $w){ $p = $multi[$z]; $pmod = str_replace("_"," ",$p); echo "<a href='tag.php?tag=$p'" . $p . ">" . $pmod . "</a> "; $z++; } ?> HI all, something that keeps bothering me is that i do not fully understand the usefullness of the \n newline character. When i use for testing in a string it doesn't show the effect in my browser. Only when I press view source I can see that right after the \n character the code jumps down 1 line. Does anyone know how and when to use it? I have see it with the php mail function, but i don't really understand why they use it. If someone could enlighten me i would be very happy All, I have a zip code and for example the zip code is 01101. How can I determine if the first character in this is a zero? Thanks in advance. Thanks to the advice of others on PHPFreaks, I have decided that allowing any character for certain fields on my "Add an Article" form. However, I still want to define a length between 2 and 100. How do I re-write my RegEx to accomplish this? Befo Code: [Select] // Check HTML Title. if (empty($trimmed['htmlTitle'])){ $errors['htmlTitle'] = 'Please enter an HTML Title.'; }else{ if (preg_match('#^[A-Z \'.-]{2,100}$#i', $trimmed['htmlTitle'])){ $htmlTitle = $trimmed['htmlTitle']; }else{ $errors['htmlTitle'] = 'HTML Title must be 2-100 characters (A-Z \' . -)'; } } Here is my best guess... After: Code: [Select] // Check HTML Title. if (empty($trimmed['htmlTitle'])){ $errors['htmlTitle'] = 'Please enter an HTML Title.'; }else{ if (preg_match('#^[.*]{2,100}$#i', $trimmed['htmlTitle'])){ $htmlTitle = $trimmed['htmlTitle']; }else{ $errors['htmlTitle'] = 'HTML Title must be 2-100 characters (A-Z \' . -)'; } } Debbie so if I have a a string of text or something like Code: [Select] http://www.yahoo.com/ajhsijd908340 I can use str_replace to remove "http://" but what can I use to remove the "ajhsijd908340" if every time it is a different set of characters? I am terribly confused... I am trying to display the html body of a message pulled through imap. I thought that if I did this: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> in the html head, that everything would be pretty much figured out for me, but... When I look at the original message in gmail (prior to being pulled with imap), I get an ellipses(...), but once I display it in my browser, I get a black diamond question mark thingy... Help! I've tried all manners of conversion, but suspect I'm completely missing the boat here. Thanks Im bug fixing a script (not my own) and the use of " and ' hasn't been filtered out before an insert query is ran. there are about 4 scripts of 30 $_POST["something"] input elements that need to be checked, and i was wondering can i just do a find and replace on $_POST rather than each element? Thanks. Array ( [0] => Virender Sehwag|||http://abc.xyz.com/Virender-Sehwag [1] => Sachin Tendulkar|||http://abc.xyz.com/Sachin-Tendulkar ) foreach($array as $arr) { $topics=explode ('|||', $array); echo '<li>' .'<a rel="nofollow" target="_new" href="'.$topics[1].'"><span class="title">'.html_entity_decode($topics[0], ENT_NOQUOTES, "UTF-8").'</span></a>|</li>'; How to avoid '|' for the last element of any aaray. Also if array contains only 1 element '|' should not appear. For eample, In the browser it should display as "Virender Sehwag | Sachin Tendulkar". If the array contains only 1 element then, In the browser it should display as Virender Sehwag if array contains 3 elements, Virender Sehwag | Sachin Tendulkar | someword <form action="main.php?id=test.php" method="post"> <input name="name" type="text" /> <input name="submit" type="submit" value="Look Up" /> </form> <?php if(isset($_POST['submit'])) { $today = date("Y-m-d"); $pname = rawurlencode($_POST['name']); $xml_feed_url = 'http://api.eve-online.com/eve/CharacterID.xml.aspx?names='.$pname.''; The above works perfect until the user enters a character like ' to the box, how do I get it to pass the ' into the address? Thank you How to remove the last character of a string if it is "-" ? In replacing some elements in strings, sometimes "-" remains at the end. How to trim the string by removing "-", if it is at the end of the string? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342991.0 |