PHP表单插入\到代码

I'm using a form to pull an iframe code from the user and insert it into another page. However, when the code is pulled in, it's inserting a "\" into the mix.

Here is the original code:

<iframe src='http://listings.realbird.com/home-search-o/?rb_id=N7T5O2I2&bq=[item type:housing][location:@%22Reno, Nv%22][listing type:housing/sale][property type:/foreclosure]&orderby=price' frameborder='0' width='100%' height='2700' style='width:100%; height:2700px;'></iframe>

Here is the code after the php file has processed:

<iframe src=\'http://listings.realbird.com/home-search-o/?rb_id=N7T5O2I2&bq=[item type:housing][location:@%22Reno, Nv%22][listing type:housing/sale][property type:/foreclosure]&orderby=price\' frameborder=\'0\' width=\'100%\' height=\'2700\' style=\'width:100%; height:2700px;\'></iframe>

Any way to prevent that from happening?

This looks like magic quotes to me. You could try replacing all instances of ' with &apos;

Or look into the PHP method stripslashes

Take a look here: http://www.dreamincode.net/forums/topic/147880-does-php-5-automatically-addslashes/

Some PHP default configuration is automatically adding slashes on content submitted on your form so that it will be "safer" to work with it if you want to insert it into a database or something like that.

If you want to prevent that behaviour I think you can turn it off for your entire php application by using something like: set_magic_quotes_runtime(false);

http://www.php.net/manual/en/function.set-magic-quotes-runtime.php

Give it a try.