1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
   |  <?php
if(isset($_POST['AJOUTER'])&& ($_POST['AJOUTER'])== 'AJOUTER')
{
    if(
        (isset($_POST['nom']) && !empty($_POST['nom'])) &&
        (isset($_POST['prenom']) && !empty($_POST['prenom'])) &&
        (isset($_POST['sexe']) && !empty($_POST['sexe'])) &&
        (isset($_POST['dat']) && !empty($_POST['dat'])) &&
        (isset($_POST['lieu']) && !empty($_POST['lieu'])) 
        //(isset($_POST['image']) && !empty($_POST['image']))
    )
    {
        $image_tmp = $_FILES['image']['tmp_name'];
        $image_name = $_FILES['image']['name'];
        $image_size = $_FILES['image']['size'];
        $image_type = $_FILES['image']['type'];   
        $donnees = addslashes(fread(fopen($image_tmp, 'r'), $image_size));                  
 
        mysql_query('INSERT INTO eleve VALUES("","'.$_POST['nom'].'","'.$_POST['prenom'].'","'.$_POST['dat'].'","'.$_POST['lieu'].'","'.$_POST['sexe'].'","'.$donnees.'")') or die ('Erreur <br/>'.mysql_error());
 
    }    
} | 
Partager