affordit Posted August 17, 2009 Share Posted August 17, 2009 I am using stripslashes like this echo stripslashes($stepd)."<br>"; But it does not remove all the slashes, what am I doing wrong? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/170737-problem-with-stripslashes/ Share on other sites More sharing options...
oni-kun Posted August 17, 2009 Share Posted August 17, 2009 Give us $stepd's contents? Stripslashes only removes the escape character '\' once. This should replace all and be UTF safe.. <?php preg_replace(array('/\x5C(?!\x5C)/u', '/\x5C\x5C/u'), array('','\\'), $string); ?> You can use str_replace() as well alongside without much effort. Quote Link to comment https://forums.phpfreaks.com/topic/170737-problem-with-stripslashes/#findComment-900466 Share on other sites More sharing options...
affordit Posted August 17, 2009 Author Share Posted August 17, 2009 This is the form <script src="addInput.js" language="Javascript" type="text/javascript"></script> <form method="POST" action="inputresult.php"> <div id="dynamicInput"> Step 1<br><textarea name="mysteps[]"></textarea> </div> <input type="button" value="Add another Step" onClick="addInput('dynamicInput');"> <input type="submit" value="Do It"> </form> It goes here for them to confirm <?php echo "<form method='post' action='except.php'>"; $mysteps = $_POST["mysteps"]; $i=1; foreach ($mysteps as $eachInput) { echo "<textarea value='".$eachInput . "' name='step".$i." cols='50'>$eachInput</textarea><br>"; $i++; } print "<input type='submit' value='Publish Now'><br></form>"; ?> and I have this page set up to test the output <?php include("bdinfo.php"); $stepa=$_POST['stepa']; $stepb=$_POST['stepb']; $stepc=$_POST['stepc']; $stepd=$_POST['stepd']; $stepe=$_POST['stepe']; $step6=$_POST['step6']; $step7=$_POST['step7']; $step8=$_POST['step8']; $step9=$_POST['step9']; $step10=$_POST['step10']; echo $name."<br>"; echo $password."<br>"; echo $database."<br>"; echo $stepa."<br>"; echo $stepb."<br>"; echo $stepc."<br>"; echo $stepd."<br>"; echo stripslashes($stepe)."<br>"; ?> Thank you Quote Link to comment https://forums.phpfreaks.com/topic/170737-problem-with-stripslashes/#findComment-900477 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.