nesiak Posted May 18, 2007 Share Posted May 18, 2007 Great news, i ran into another problem Everything is doing ok except one thing, this is the part that should change the links of my site, and it does change them into something weird check this out> code to post the code <form name="input" action="changetop.php" method="post"> <p><textarea name="text" rows="20" cols="60"><?php include("http://nenadspp.freehostia.com/php/include/link.php"); ?></textarea></p> <p><input type="submit" name="go" value="Change links"></p> </form> code to get the code <?php function writetofile() { $file=fopen("sidelink.php","w"); $text = $_POST["text"]; fwrite ($file,$text); echo 'Links are changed'; fclose($file); } writetofile(); ?> It's a simple code, nothing complicated but for some reason it inserts backslashes in some parts of the text when i post it (between the quotes "")> This is the original code for links <style type="text/css"> .navigation { font-family: Verdana, sans-serif; font-size: 16px; font-style: normal; font-weight: bold; color: #FFFFFF; padding: 8px; width: 140px; } .navigation:hover { font-family: Verdana, sans-serif; font-size: 16px; font-style: normal; font-weight: bold; color: #FFFFFF; padding: 8px; width: 140px; } </style> <a href="#" class="navigation">Link 1</a> <a href="#" class="navigation">Link 2</a> <a href="#" class="navigation">Link 3</a> <a href="#" class="navigation">Administration</a> And this is the messed up part <style type=\"text/css\"> .navigation { font-family: Verdana, sans-serif; font-size: 16px; font-style: normal; font-weight: bold; color: #FFFFFF; padding: 8px; width: 140px; } .navigation:hover { font-family: Verdana, sans-serif; font-size: 16px; font-style: normal; font-weight: bold; color: #FFFFFF; padding: 8px; width: 140px; } </style> <a href=\"#\" class=\"navigation\">Link 1</a> <a href=\"#\" class=\"navigation\">Link 2</a> <a href=\"#\" class=\"navigation\">Link 3</a> <a href=\"#\" class=\"navigation\">Administration</a> That f*cks up the entire code How do i solve this Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/ Share on other sites More sharing options...
yzerman Posted May 18, 2007 Share Posted May 18, 2007 $str = '<a href=\"http://www.phpfreaks.com\">PHPFreaks!</a>'; echo stripslashes($str); will return: <a href="http://www.phpfreaks.com">PHPFreaks!</a> Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256293 Share on other sites More sharing options...
nesiak Posted May 18, 2007 Author Share Posted May 18, 2007 Yeah but how do i incorporate it into my code (in HTML ?)? Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256300 Share on other sites More sharing options...
nesiak Posted May 18, 2007 Author Share Posted May 18, 2007 Can't anybody help me ? Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256352 Share on other sites More sharing options...
pikemsu28 Posted May 18, 2007 Share Posted May 18, 2007 <?php $text = stripslashes($_POST["text"]); ?> Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256358 Share on other sites More sharing options...
nesiak Posted May 18, 2007 Author Share Posted May 18, 2007 Yup that worked, why the hell would they add those stupid slashes ? Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256392 Share on other sites More sharing options...
per1os Posted May 18, 2007 Share Posted May 18, 2007 They add the slashes for "security" reasons when working with databases. www.php.net/get_magic_quotes_gpc That is the function to tell if they are on, I am sure if you read more into it you can figure out how to turn them off. Quote Link to comment https://forums.phpfreaks.com/topic/52004-solved-weird/#findComment-256395 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.