By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Form submit IE Error

P: 3
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.

Expand|Select|Wrap|Line Numbers
  1. function exportPDF(prosjekt,url){
  2.    var poststr4=new Array();
  3.    poststr4["prosjekt"] = prosjekt;
  4.    var html = openRepres(prosjekt);
  5.    poststr4["html"]="<head></head><body>"+html+"</body>";
  6.  
  7.    //---------------POINT 1--------------//
  8.    document.write(poststr4["html"]); 
  9.  
  10.    var method = "post"; 
  11.    var form = document.createElement("form"); 
  12.    form.setAttribute("method", method); 
  13.    form.setAttribute("action", url); 
  14.    for(var k in poststr4) { 
  15.         var hiddenField = document.createElement("input");
  16.         hiddenField.setAttribute("type", "hidden"); 
  17.         hiddenField.setAttribute("name", k); 
  18.         hiddenField.setAttribute("value", poststr4[k]);
  19.         form.appendChild(hiddenField); 
  20.     } 
  21.     document.body.appendChild(form);
  22.  
  23.     //----------------POINT 2-----------//
  24.     form.submit(); 
  25.  
  26.     document.body.removeChild(form);
  27. }
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!
Jul 23 '10 #1

✓ answered by Dormilich

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

Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
Why is this?
thatís a setting in your php.ini. namely magic_quotes_gpc. if that should be disabled, either the server or IE is applying the backslashes. easiest workaround for that: stripslashes().
Jul 23 '10 #2

P: 3
@Dormilich
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
Jul 23 '10 #3

Dormilich
Expert Mod 5K+
P: 8,639
Note: magic_quotes_gpc is deprecated as of PHP 5.3.0 and will be removed in PHP 6.
Jul 23 '10 #4

P: 3
@Dormilich
good to know, because it was a headache this morning for me:P

Thank you
Jul 23 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.