1.11M Members

Javascript Form Submit IE issue

 
0
 

Hello everybody:

This is my first thread in here. I readed a lot of good problems and solutions in this webpage. Right now im having troubles with one form submit in IE.

Here's the thing. I'm trying to generate a PDF in PHP, i'm using mPDF to show the html code with css. I sent through Post the hmtl code with a javascript form like this.

function exportPDF(prosjekt,url){
   var poststr4=new Array();
   poststr4["prosjekt"] = prosjekt;
   var html = openRepres(prosjekt);
   poststr4["html"]="<head></head><body>"+html+"</body>";

   //---------------POINT 1--------------//
   document.write(poststr4["html"]); 

   var method = "post"; 
   var form = document.createElement("form"); 
   form.setAttribute("method", method); 
   form.setAttribute("action", url); 
   for(var k in poststr4) { 
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden"); 
        hiddenField.setAttribute("name", k); 
        hiddenField.setAttribute("value", poststr4[k]);
        form.appendChild(hiddenField); 
    } 
    document.body.appendChild(form);
 
    //----------------POINT 2-----------//
    form.submit(); 

    document.body.removeChild(form);
}

In this code, when i show the code in POINT1 with document write, the table that i sent is in this way:

<table border="1" class="wind">...

However, when i send the form to the URL in Point 2, the code that arrives is like this:

<table border=\"1\" class=\"wind\">...

So what it does the form.submit is putting a slash in every " that is sent.

Why is this?The worst thing is that it hapenned to me after changing my server from Apache to IIS 6.0 (I dont like IIS, but is mandatory for the job)

Thank you!

 
0
 

Ok i found the solution:

If someone see this, it is a setting in the php.ini. namely magic_quotes_gpc that should be disabled

restart the server and works:)

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: