Jump to content

error receiving backslash in form data


ritwick

Recommended Posts

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']);

 

The PHP output:

PARENT: \\admin

Link to comment
https://forums.phpfreaks.com/topic/93669-error-receiving-backslash-in-form-data/
Share on other sites

Nevermind. I've used a bruteforce approach and now my code works correctly after modifying the PHP into:

 

$pardir= trim($_POST['parent_dir']);
$pardir= str_replace('\\\\','\\',$pardir);
print $pardir;

 

Thanks again for your prompt reply friend!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.