wellso
asked on
PHP and Internet Explorer - foreach loop making duplicate entrys
Hi there,
Having problems with IE inserting duplicate entrys into a database from an array of checkboxes in the $_POST header. It only happens on IE and not Firefox and I am completely stumped as to why? Can any shed any light on this?
Having problems with IE inserting duplicate entrys into a database from an array of checkboxes in the $_POST header. It only happens on IE and not Firefox and I am completely stumped as to why? Can any shed any light on this?
if($_POST['query']=="add" && count($_POST['rep']) >= 1){
foreach($_POST['rep'] as $value){
$insert = "INSERT INTO DOCSLINKS (LINK_ID, DOC_ID, ORDER_ID) VALUES (LINK_ID_SEQ.nextval, '$value' ,'$am')";
$statement = oci_parse($connect,$insert);
oci_execute($statement);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
INSERT INTO DOCSLINKS (LINK_ID, DOC_ID, ORDER_ID) VALUES (LINK_ID_SEQ.nextval, '1091' ,'AM12345')
It only seems to go round the loop once but inserts two records, it puzzles me how it only happens in IE
It only seems to go round the loop once but inserts two records, it puzzles me how it only happens in IE
ASKER
https://www.experts-exchange.com/questions/23791556/IE-cannot-send-post-to-PHP-form-where-Firefox-works-fine.html
Found out the problem, turns out Javascript was submitting the form twice. I have various buttons on the form to perform different functions which trigger onclick events in JavaScript, one of which is submit(); the input type was still set to submit on the offending button leading to dual submissions of the form, I presume Firefox must have catched this and only submitted once, good job I am not designing an eccommerce credit card submission system hehe. Thanks for the help all the same.
Found out the problem, turns out Javascript was submitting the form twice. I have various buttons on the form to perform different functions which trigger onclick events in JavaScript, one of which is submit(); the input type was still set to submit on the offending button leading to dual submissions of the form, I presume Firefox must have catched this and only submitted once, good job I am not designing an eccommerce credit card submission system hehe. Thanks for the help all the same.
ASKER
Thanks for the help, got it sorted in the end : pesky JavaScript handling in IE :)
ASKER