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
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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.