M.Sidim
M.Sidim

Reputation: 303

Difficulty with my form on IE

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?

Upvotes: 0

Views: 49

Answers (1)

Zeeba
Zeeba

Reputation: 1122

try adding this to you meta tags

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

Upvotes: 1

Related Questions