Writing a file with special characters


I am trying to write a file using php. The file contains the following line:

<form name='redirect' method='post' action="$foo1"><input type='hidden' name='temp_sid' value="$foo2">...

I need to to write the file exactly as shown. The problem I’m having is I can’t figure out how to get the action and value elements to print just as above, meaning with the backslashes and quotes. I’ve tried all sorts of additional backslashes, etc…but I still can’t get the output to look exactly like my example above. I’m certain this is very easy…except for me!

Thanks in advance for any assistance.

Have you tired addslashes()?

Not sure if that would help, but thought I would through it out there.

I have messed with addslashes, yes…but have yet to come up with the magic formula which gets me the exact results I’m looking for.

Sponsor our Newsletter | Privacy Policy | Terms of Service