ArizonaJohn Posted June 8, 2009 Share Posted June 8, 2009 Hi, If I enter an apostraphe into the form below, it comes out as \\\\\\\' after it runs through all the code below. That's right, seven backslashes in front of the apostraphe. Is there an easy way to solve this? Thanks in advance, John <div class="searchbox"> <form action="search.php" method="post"> <label>Enter Topic: <input type="text" name="find" size="55"/> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </label> </form> </div> On search.php: <?php ob_start(); session_start(); $find = strip_tags($_POST['find']); $find = trim ($find); $find = strtolower($find); $_SESSION['find'] = $find; ?> <? $find = mysql_real_escape_string($find); $find = htmlentities($find); $anymatches=mysql_num_rows($result); if ($anymatches == 0) { $_SESSION['find'] = $find; session_write_close(); header("Location:search2.php?find=$find"); exit; } } ?> On search2.php: <? $_GET['find'] = $find; print "<p class=\"topic2\">The topic \"{$_GET['find']}\" has not been added.</p>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/161398-apostraphe-problem/ Share on other sites More sharing options...
ldougherty Posted June 8, 2009 Share Posted June 8, 2009 What exactly is it you are trying to have users input on the field? If we understood clearly what it is you are trying to do and to avoid we would be able to help out better. Link to comment https://forums.phpfreaks.com/topic/161398-apostraphe-problem/#findComment-851805 Share on other sites More sharing options...
ArizonaJohn Posted June 8, 2009 Author Share Posted June 8, 2009 Ideally, I would like most special characters to be permitted. Is there some sort of workaround that allows that? Link to comment https://forums.phpfreaks.com/topic/161398-apostraphe-problem/#findComment-851808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.