matthewst Posted September 13, 2007 Share Posted September 13, 2007 I have this code: <select name="header" size="1"> <option value="">-- Select a header image --</option> <option value="<?php echo "<img src='../../styles/BBQ1.jpg'>" ?>">BBQ 1</option> <option value="<?php echo "<img src='../../styles/BBQ2.jpg'>" ?>">BBQ 2</option> <option value="<?php echo "<img src='../../styles/BBQ3.jpg'>" ?>">BBQ 3</option> <option value="<?php echo "<img src='../../styles/Garden1.jpg'>" ?>">Garden 1</option> <option value="<?php echo "<img src='../../styles/Gray1.jpg'>" ?>">Gray 1</option> <option value="<?php echo "<img src='../../styles/Wine1.jpg'>" ?>">Wine1</option> </select> pointing to this code on another page: $stringData = "<table width='60%' height='95%' border='0'><tr><td colspan='2' align='center' height='75px'>$header"; fwrite($fh, $stringData); it keeps adding backslashes to the string: <table width='60%' height='95%' border='0'><tr><td colspan='2' align='center' height='75px'><img src=\'../../styles/BBQ3.jpg\' /> right after src= and right after bbq3.jpg Any one know where they're coming from? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Share Posted September 13, 2007 There is an extra backslash at the end of the image, I will make it bold. <img src=\'../../styles/BBQ3.jpg\' /> Try taking that out. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 poco, that is required by XHTML standards, it's the closing tag for an image. matthew those slashes can be removed with http://php.net/stripslashes Quote Link to comment Share on other sites More sharing options...
matthewst Posted September 13, 2007 Author Share Posted September 13, 2007 checking on strip slashes now Quote Link to comment Share on other sites More sharing options...
matthewst Posted September 13, 2007 Author Share Posted September 13, 2007 OK, magic quotes is on so I have no choice but to use stripslashes. I've never used it before so I'm not sure where to put it. Does it go in my drop down menu or on the fwrite page? Quote Link to comment Share on other sites More sharing options...
matthewst Posted September 13, 2007 Author Share Posted September 13, 2007 I tried: stripslashes ($header); $stringData = "<table width='60%' height='95%' border='0'><tr><td colspan='2' align='center' height='75px'>$header"; fwrite($fh, $stringData); and this: $stringData = "<table width='60%' height='95%' border='0'><tr><td colspan='2' align='center' height='75px'>$header"; stripslashes ($stringData); fwrite($fh, $stringData); but it doesn't do anything. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 If you don't want to use magic quotes at all (which I recommend not using it) You can turn magic quotes gpc and runtime off using http://php.net/ini_set or if you have access to your php.ini file, in there. I don't quite see where you're even writing that variable, so it's hard to see where to use it. Your code doesn't make sense to me. I guess use it on your fwrite part? edit: you have to assign it to a new string. $header = stripslashes($header). See in the manual that it returns a string? Quote Link to comment Share on other sites More sharing options...
matthewst Posted September 13, 2007 Author Share Posted September 13, 2007 You fricken rock. My code probably doesn't make sense to you because I put the oob in noob. Thanks!! Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 No problem lol Quote Link to comment 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.