0

I want to send html data like,

<div style='padding: 0px; overflow: auto; width: 194px;' id='bar1'><div style='float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 60px'><div style='float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;'></div></div></div>

from one php page to another. I have tried doing this via POST but all the div data gets changes to this in the page I am sending the html data to,

<div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 20px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 4px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 4px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 2px\'></div><div style=\'float: left; font-size: 0px; width:0; border-left: 2px solid #000000; height: 40px;\'></div><div style=\'float: left; font-size: 0px; background-color: #FFFFFF; height: 40px; width: 20px\'></div><div style=\'clear:both; width: 100%; background-color: #FFFFFF; color: #000000; text-align: center; font-size: 11px; margin-top: 5px;\'>asdc</div>

Can anyone tell me where am I going wrong with this and how can I keep the integrity of the data between the php pages.

EDIT 1: Code that is sending the data is as follows, (#pdf_data is a textarea)

function export_as_pdf2(div_id)
{
            removeAllLinks('remove');
        div_id = 'bar1';
    var content = $('#'+div_id).html();
            content=content.replace(/\"/g,'\'');

    $('#pdf_data').val(content);
    $('#pdf_format_form').submit();
}
4

1 回答 1

0

Magic Quote 在您的 php.ini 设置中启用,这就是它自动将斜杠 () 添加到每个单引号的原因。关闭魔术报价,因为这是很好的做法。如果没有,请使用 stripslashes($_POST['post_var'])。不要再使用 $_REQUEST,这不是一个好习惯。

于 2012-10-15T05:38:51.470 回答