preg_replace problems

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


  I have a form whose values are being read from a text file. After The
changes are made in the text box, I am writing all the form values to
another text file. This form has a few fields that have the directory
structure. When I use $_POST["id"] to write the values of the form, the
directory structure gets messed up.

For instance, if the value for id = 0 is -> D:/Test/Data/data.txt, When
I write this to the text file using $_POST["0"] it becomes ->

I tried to use preg_replace('/\\\\/', '/\\/', $string), I get


I need to make this look like D:/Test/Data/data.txt

Any pointers in the right directions will Help...


Re: preg_replace problems

I fixed the error. I did not realize that I was using the wrong replace

preg_replace('/\\\\/', '\', $string) did the job.

Site Timeline