error receiving backslash in form data

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
ritwick
Forum Newbie
Posts: 1
Joined: Fri Feb 29, 2008 3:04 am

error receiving backslash in form data

Post by ritwick »

Hi,
I have simple module for submitting a form data and printing it.
The problem is, if there is any occurrence of backslash in the form data, it is doubled! i.e. there are two backslashes instead of one in the received data.
I've tried inserting set_magic_quotes_runtime = 0; , but still have the problem.
Thanks in advance.

- Ritwick

The form source:

<form name="seldir" id="seldir" action="./add_pages.php" method="post">
<input type="hidden" name="parent_dir" id="parent_dir" value="\admin">
</form>
The PHP value catching code in (add_pages.php) :
print 'PARENT: '.($_POST['parent_dir']).'<br>';
The PHP output:
PARENT: \\admin
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: error receiving backslash in form data

Post by Christopher »

Use stripslashes().
(#10850)
Post Reply