Reputation: 37
I've been seraching for a solution on my problem for several days, but I haven't found a solutiuon that solves my problem. I hope someone here might be able to help me out or to point me in the right direction. My problem is the following: I'm using jquery (1.9.0) and jquery-ui (1.10.1). I have a page with a form, which should be posted to a php-script to add or update data into my database. All works fine in FF and even in IE 8 and IE 10. But in IE9 the data just isn't submitted: var_dump'ing the $_POST-array gives me an empty array, nothing is posted.
Here is the code (I'll submit the essentials:
<form name="documents" id="documents" method="POST" action="inc/add_new_doc.php">
<table class="invoer" align="left">
<tr>
<th align="left" colspan="8"><h2>Please fill out all fields</h2></th>
</tr>
<tr>
<td align="right">Originator:</td>
<td colspan="2"><select name="company_id" id ="company_id"><?php echo getCompanyList(0); ?></select></td>
<td>Originator document number:</td>
<td colspan="2"><input name="docnrsupplier" id="docnrsupplier" type="text" size="30" tabindex="2" /></td>
<td>Document category:</td>
<td><select name="doccat_id" id ="doccat_id"><?php echo getDocCatList(0); ?></select></td>
</tr>
<tr>
<td ></td>
<td colspan="2"><b>LAB GmbH</b></td>
<td>LAB document number:</td>
<td colspan="2"><input name="docnrlab" id="docnrlab" type="text" size="30" tabindex="2" /></td>
<td>Document size:</td>
<td><select name="docsize_id" id ="docsize_id"><?php echo getDocSizeList(0); ?></select></td>
</tr>
<tr>
<td align="right">Client:</td>
<td colspan="2"><b>CEH</b></td>
<td>Client document number:</td>
<td colspan="2"><input name="docnrclient" id="docnrclient" type="text" size="30" tabindex="2" /></td>
<td>Current revision:</td>
<td><select name="revi" id ="revi"><?php echo buildAZSelector(); ?></select></td>
</tr>
<tr>
<td align="right">Title (line 1):</td>
<td colspan="5"><input name="title1" id="title1" type="text" size="100" tabindex="2" /></td>
<td>Current doc. phase:</td>
<td><select name="docphase_id" id ="docphase_id"><?php echo getDocPhaseList(0); ?></select></td>
</tr>
<tr>
<td align="right">Title (line 2):</td>
<td colspan="5"><input name="title2" id="title2" type="text" size="100" tabindex="2" /></td>
</tr>
<tr>
<td align="right">Title (line 3):</td>
<td colspan="5"><input name="title3" id="title3" type="text" size="100" tabindex="2" /></td>
</tr>
<tr>
<td align="right">Title (line 4):</td>
<td colspan="5"><input name="title4" id="title4" type="text" size="100" tabindex="2" /></td>
</tr>
<tr>
<td align="right">File formats:</td>
<td align="right"><i>editable:</i></td>
<td ><select name="docformat_editable_id" id ="docformat_editable_id"><?php echo getDocFormatList(0, 1); ?></select></td>
<td align="right">Filename:</td>
<td colspan="4" align="left"><input name="file_editable" id="file_editable" type="text" size="50" tabindex="2" /></td>
</tr>
<tr>
<td align="right"></td>
<td align="right"><i>non-editable:</i></td>
<td ><select name="docformat_noneditable_id" id ="docformat_noneditable_id"><?php echo getDocFormatList(0, 0); ?></select></td>
<td align="right">Filename:</td>
<td colspan="4" align="left"><input name="file_noneditable" id="file_noneditable" type="text" size="50" tabindex="2" /></td>
</tr>
<tr>
<td></td>
<td colspan="8">
<div class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="submitNewDoc" role="button" aria-disabled="false">
<span class="ui-button-text">Submit</span>
</div>
<div class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="cancelNewDoc" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</div>
</td>
</tr>
</table>
</form>
The jquery for the Submit-button:
$( "#submitNewDoc" )
.button()
.click(function() {
$( "#documents" ).submit();
});
When I test in FF and in IE8 or IE10, the data gets posted just fine. Only in IE9 the data is not being posted, I receive "array{}".
Does anyone have an idea what I am doing wrong?
** update in reply to Muhammed's question **
There's nothing in the php-file except the MySQL-query:
// All general includes
require_once('config.php');
require_once('functions.general.php');
require_once('functions.dbase.php');
//require_once("standardLists.php");
// make a connection, so we can use mysql_real_escape_string
$con = mysql_connect($db_host, $db_user, $db_password);
if (!$con) { die('Could not connect: ' . mysql_error()); }
// Initialise database object and establish a connection
// at the same time - db_user / db_password / db_name / db_host
$db = new ezSQL_mysql($db_user,$db_password,$db_name,$db_host);
var_dump($_POST); // testing
/* Storing the info into the DB */
$sql1 = "INSERT INTO documents
(company_id, docnrsupplier, docnrlab, docnrclient, title1, title2, title3,
title4, docformat_editable_id, docformat_noneditable_id, file_editable, doccat_id, docsize_id, docphase_id, file_noneditable)
VALUES (
'".$_POST['company_id']."',
'".$_POST['docnrsupplier']."',
'".$_POST['docnrlab']."',
'".$_POST['docnrclient']."',
'".$_POST['title1']."',
'".$_POST['title2']."' ,
'".$_POST['title3']."',
'".$_POST['title4']."',
'".$_POST['docformat_editable_id']."',
'".$_POST['docformat_noneditable_id']."',
'".$_POST['file_editable']."' ,
'".$_POST['doccat_id']."' ,
'".$_POST['docsize_id']."' ,
'".$_POST['docphase_id']."' ,
'".$_POST['file_noneditable']."')";
** update 2 **
I have tried it now with bothtypes of button, but the result in IE9 stays the same: array(0) { }
while IE8 and IE10 at least give me
array(16) { ["company_id"]=> string(0) "" ["docnrsupplier"]=> string(0) "" ["doccat_id"]=> string(0) "" ["docnrlab"]=> string(0) "" ["docsize_id"]=> string(0) "" ["docnrclient"]=> string(0) "" ["revi"]=> string(1) "A" ["title1"]=> string(0) "" ["docphase_id"]=> string(0) "" ["title2"]=> string(0) "" ["title3"]=> string(0) "" ["title4"]=> string(0) "" ["docformat_editable_id"]=> string(0) "" ["file_editable"]=> string(0) "" ["docformat_noneditable_id"]=> string(0) "" ["file_noneditable"]=> string(0) "" } `
<input class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="mySubmit" type="submit" value="Submit" />
<div class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="submitNewDoc" role="button" aria-disabled="false">
<span class="ui-button-text">Submit</span>
</div>
I'm sure I have made a mistake, I just cannot find it :-( Can it be that there is a problem with having two forms on the same page? They do have their own name and id and there are no double fieldnames..
Upvotes: 1
Views: 704
Reputation: 37
I think I've found it, although I am quite unhappy with it:
The form-fields were nested as inside a table:
<form><table><tr><td><input...>
as you can see in my original question.
After searching on SO further I read sth about issues with a table within a form inside a jquery accordion. Just for trying I removed all html concerning the table, so now I have sth like <accordion> -> <form> -> <input ....>
And that works! So, for some reason the nesting I did must have hit a bug in IE9.
It looks awful, but it works. It's for internal use anyway, so it'll have to do.
I hope this may help others, who met this issue too.
Upvotes: 1