Form submit IE Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thenanox
    New Member
    • Jul 2010
    • 3

    #1

    Form submit IE Error

    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.

    Code:
    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!
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Why is this?
    that’s a setting in your php.ini. namely magic_quotes_gp c. if that should be disabled, either the server or IE is applying the backslashes. easiest workaround for that: stripslashes().

    Comment

    • thenanox
      New Member
      • Jul 2010
      • 3

      #3
      Originally posted by Dormilich
      that’s a setting in your php.ini. namely magic_quotes_gp c. if that should be disabled, either the server or IE is applying the backslashes. easiest workaround for that: stripslashes().
      ok, i changed the PHP.ini putting off that attribute, restarted the server and now works perfect:)

      REALLY thank you, i was really anoyed searching for the solution

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Note: magic_quotes_gp c is deprecated as of PHP 5.3.0 and will be removed in PHP 6.

        Comment

        • thenanox
          New Member
          • Jul 2010
          • 3

          #5
          Originally posted by Dormilich
          Note: magic_quotes_gp c is deprecated as of PHP 5.3.0 and will be removed in PHP 6.
          good to know, because it was a headache this morning for me:P

          Thank you

          Comment

          Working...