backslash question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

backslash question

Post by Guy »

I have an input box which contains a path like c:\test\temp
when I submit the form and request the field, it doubles the backslash so I get
c:\\test\\temp, and if I'll post again I'll get c:\\\\test\\\\temp.
why is that , and what can I do to prevent this from happening?
btw - I did the same thing with asp and it didn't double the "\" .
Thanks
Guy
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

its an option in the php.ini iirc

to remove them simply use stripslashes :

Code: Select all

<form method="get">
<input type="text" name="someText" value="<? print stripslashes($_GET&#1111;'someText']); ?>">
<input type="submit">
</form>
Post Reply