0

I have a website form, which works flawlessly. Except on IE 10 where it won't work at all, although strangely enough if I enable the compatibility mode, it works 90% fine.

With it on, it will submit the form and then give me an error saying there was an error (which is an internal message about the image which has not been uploaded - although the rest of the form gets uploaded).

*So, without compatibility mode on, it won't work (it will submit blank entry results without actually proceeding to the next screen).

As for with compatibility mode, it will not upload the user's image*

I assume the problem is with the process form.

    <?php
include('config.php');
ini_set('error_reporting', E_ALL);
ini_set('display_errors', '1');

require_once('db.php');

$db = new db();

$cats = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['cats'])) {
        $cats = implode(",", $_POST['cats']);
    }
    $categories = $_POST['categories'];

    $str = $categories . ": " . $cats;
    //echo $str;
}

$data   = array();
$data[] = !empty($_POST['company']) ? $_POST['company'] : '';
$data[] = !empty($_POST['phone']) ? $_POST['phone'] : '';
$data[] = !empty($_POST['website']) ? $_POST['website'] : '';
$data[] = !empty($_POST['messagefr']) ? $_POST['messagefr'] : '';
$data[] = !empty($_POST['messageen']) ? $_POST['messageen'] : '';
$data[] = !empty($str) ? $str : '';
$data[] = !empty($_POST['profession']) ? $_POST['profession'] : '';
$data[] = !empty($_POST['manufacturiers_stand']) ? $_POST['manufacturiers_stand'] : '';
$data[] = !empty($_POST['percent_quebec']) ? $_POST['percent_quebec'] : '';
$data[] = !empty($_POST['percent_canada']) ? $_POST['percent_canada'] : '';
$data[] = !empty($_POST['percent_usa']) ? $_POST['percent_usa'] : '';
$data[] = !empty($_POST['percent_autre']) ? $_POST['percent_autre'] : '';
$data[] = !empty($_POST['bt_export']) ? $_POST['bt_export'] : '';
$data[] = !empty($_POST['bt_exporte_souhaite']) ? $_POST['bt_exporte_souhaite'] : '';
$data[] = !empty($_POST['bt_prod_verts']) ? $_POST['bt_prod_verts'] : '';
$data[] = !empty($_POST['bt_new_prod']) ? $_POST['bt_new_prod'] : '';
$data[] = !empty($_POST['name']) ? $_POST['name'] : '';
$data[] = !empty($_POST['email']) ? $_POST['email'] : '';
$data[] = !empty($_POST['resource_phone']) ? $_POST['resource_phone'] : '';
$data[] = !empty($_POST['personne_ressource']) ? $_POST['personne_ressource'] : '';
$data[] = !empty($_POST['backup_name']) ? $_POST['backup_name'] : '';
$data[] = !empty($_POST['backup_email']) ? $_POST['backup_email'] : '';
$data[] = !empty($_POST['backup_phone']) ? $_POST['backup_phone'] : '';


$result = $db->query("INSERT INTO form_corpo_test (compagnie,
                                                        telephone,
                                                        site_web,
                                                        texte_fr,
                                                        texte_en,
                                                        categories,
                                                        profil_exposant,
                                                        stands_du_manufacturier,
                                                        pourcentage_quebec,
                                                        pourcentage_canada,
                                                        pourcentage_usa,
                                                        pourcentage_autre,
                                                        exporte,
                                                        exporte_souhaite,
                                                        produits_vert,
                                                        nouveau_produits,
                                                        nom,
                                                        courriel,
                                                        telephone_ressource,
                                                        personne_ressource_c_toi,
                                                        autre_personne_ressource,
                                                        autre_courriel,
                                                        autre_telephone)



                                                        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", $data);



if (!$result) {
    echo 'Veuillez nous contactez si vous voyez ce message';
}


$pic = ($_FILES['photo']['name']);
$pic = (mysql_real_escape_string($_FILES['photo']['name']));


$dirPath   = $_POST['company'];
$dirExists = is_dir($dirPath);

if (@!dirExists)
    $dirExists = mkdir($dirPath, 0755);

@$result = mkdir($dirPath, 0755);
if ($result == 1) {
    echo '<br/>' . 'Le dossier ' . $dirPath . " a été créer" . '<br/>';
} else {
    echo '<br/>' . "Le dossier " . $dirPath . " n'a PAS été créer car il existe déja" . '<br/>';
}


$folder_name = $dirPath;
$folder      = $folder_name . '/';
$folder      = $folder . basename($_FILES['photo']['name']);


if ($_FILES["photo"]["size"] >= 10485760) {
    echo "F2";
    die();
}

if (move_uploaded_file($_FILES['photo']['tmp_name'], $folder)) {


    echo '<br/>' . "Le fichier " . basename($_FILES['photo']['name']) . " a été téléchargé" . '<br/>' . '<br/>' . "Et nous avons bien recu votre formulaire!" . '<br/>';
} else {


    echo '<br/>' . "Désolé, mais il y a eu une erreur." . '<br/>';
}



?>

Upon the request of posting my form here (it was too long by 2,000 characters), so I posted it on a fiddle:

http://jsfiddle.net/NdRJV/

EDIT:

As Zeeba suggested, I forced the IE to read another browser:

I used

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">

But, to read more on the topic, anyone else in need of this can visit: What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?

Community
  • 1
  • 1
M.Sidim
  • 303
  • 3
  • 4
  • 15
  • maybe tidyup the code before asking for help with it. Remove all the commented out bits, trim it down to a more sensible length. – Spudley Oct 15 '13 at 15:13
  • A few things to check..... Check the encoding: you probably want UTF-8 all through. Use the dev tools to compare the request data being sent in IE and other browsers. Maybe you'll see something there which gives you a clue Also, please confirm which IE version(s) you're testing with. – Spudley Oct 15 '13 at 15:14
  • Where exactly are you getting the error? And have you checked $_FILES itself for any errors? And what does your form look like? – CBroe Oct 15 '13 at 15:20
  • @Spudley: Pardon my ignorance, but how would you do this? I mean verifying what you're asking. Used it on IE 10. – M.Sidim Oct 15 '13 at 15:40
  • @ CBroe, I assume you mean the error log? If so, here it is on a pastebin: http://pastebin.com/xWxDPD02 – M.Sidim Oct 15 '13 at 15:41
  • @M.Sidim: okay, (1) Encoding: See [UTF-8 All The Way Through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through). (2) Use F12 to open Dev Tools in IE and Chrome. Run the code to save the data. Find the network traffic report in both browsers' dev tools, and see the entry for the post made by your form. Use this to compare the raw data that is being sent. (further advice on using dev tools is outside the scope of a comment here, but a bit of googling should get you on the right track) – Spudley Oct 15 '13 at 15:45
  • IE keeps stopping to respond after this line: SCRIPT5009: 'validate' is undefined. It is speaking about the following (but the following proceeds something, so why would IE say it's not defined, if it sees the other one before it as defined??)
    – M.Sidim Oct 15 '13 at 15:59
  • -_- clicked on the wrong button. I will check out the network now. – M.Sidim Oct 15 '13 at 16:02
  • Alright, so the network traffic seems normal in google chrome. Image uploaded. Info uploaded to database. As for IE, it only says pending everything in the network. – M.Sidim Oct 15 '13 at 16:08

1 Answers1

1

try adding this to you meta tags

<meta http-equiv="X-UA-Compatible" content="IE=edge" >
Zeeba
  • 1,124
  • 1
  • 12
  • 14
  • I retract that earlier comment. I tried different versions (but tested it on a test version of my work - hence why it didn't work). in my case, it's not edge, it's the 9th version. – M.Sidim Oct 15 '13 at 17:24