Page 1 sur 1

probléme d envoie de formulaire a un email

Posté : 11 déc. 2013, 04:08
par said ALLAOUI
Voila ma page , je clique sur SEND mais rien s'affiche a la page qlq un peut m'aider a trouver le probleme merci
<?php
if (isset($_POST['sent']))
{
 
    if (get_magic_quotes_gpc())
    {

  	$civility            = stripslashes(trim($_POST['civility']));
   	$name                = stripslashes(trim($_POST['name']));
	$prenom              = stripslashes(trim($_POST['prenom']));
   	$jour                = stripslashes(trim($_POST['jour']));
   	$mois                = stripslashes(trim($_POST['mois']));
   	$annee               = stripslashes(trim($_POST['annee']));
	$nationality         = stripslashes(trim($_POST['nationality']));   
	
	$sender               = stripslashes(trim($_POST['email']));
	$tel                 = stripslashes(trim($_POST['tel']));
    $adress              = stripslashes(trim($_POST['adress']));           	
	$city                = stripslashes(trim($_POST['city']));          
	$zip                 = stripslashes(trim($_POST['zip']));      
	$country             = stripslashes(trim($_POST['country'])); 
	$project             = stripslashes(trim($_POST['project']));	     
	$sty                 = stripslashes(trim($_POST['sty']));       
	 	
	$work                = stripslashes(trim($_POST['work']));         
	$native              = stripslashes(trim($_POST['native']));      	
	$first               = stripslashes(trim($_POST['first']));       
	$levelfirst          = stripslashes(trim($_POST['levelfirst']));   
	$second              = stripslashes(trim($_POST['second']));  
	$levelsecond         = stripslashes(trim($_POST['levelsecond']));    	
	$otherlanguages      = stripslashes(trim($_POST['otherlanguages']));
	$levelother          = stripslashes(trim($_POST['levelother']));   
	$choose              = stripslashes(trim($_POST['choose']));       
	$participate         = stripslashes(trim($_POST['participate']));    
	$voluntary           = stripslashes(trim($_POST['voluntary']));    
	$travel              = stripslashes(trim($_POST['travel']));    
	$findus              = stripslashes(trim($_POST['findus']));   
 

 
    }
    else
     { 	
    $civility             = trim($_POST['civility']);
   	$name                = trim($_POST['name']);
	$prenom              = trim($_POST['prenom']);
   	$jour                = trim($_POST['jour']);
   	$mois                = trim($_POST['mois']);
   	$annee               = trim($_POST['annee']);
	$nationality         = trim($_POST['nationality']);   
	
	$sender               = trim($_POST['email']);
	$tel                 = trim($_POST['tel']);
    $adress              = trim($_POST['adress']);           	
	$city                = trim($_POST['city']);          
	$zip                 = trim($_POST['zip']);      
	$country             = trim($_POST['country']); 
	$project             = trim($_POST['project']);	     
	$sty                 = trim($_POST['sty']);       
	 	
	$work                = trim($_POST['work']);         
	$native              = trim($_POST['native']);      	
	$first               = trim($_POST['first']);       
	$levelfirst          = trim($_POST['levelfirst']);   
	$second              = trim($_POST['second']);  
	$levelsecond         = trim($_POST['levelsecond']);    	
	$otherlanguages      = trim($_POST['otherlanguages']);
	$levelother          = trim($_POST['levelother']);   
	$choose              = trim($_POST['choose']);       
	$participate         = trim($_POST['participate']);    
	$voluntary           = trim($_POST['voluntary']);    
	$travel              = trim($_POST['travel']);    
	$findus              = trim($_POST['findus']);     
	
   	
	}

 

    $regex_mail = '/^[-+.\w]{1,64}@[-.\w]{1,64}\.[-.\w]{2,6}$/i';
 

    $regex_head = '/[\n\r]/';

    if($_SERVER['HTTP_REFERER'] != 'http://www.mapage.org/apply.php')
    {
      header('Location: http://www.mapage.org.com/');
    }

    elseif (empty($name) 
    
           || empty($sender) 
           || empty($prenom) 
           || empty($project))
    {
      $alert = 'All fields must be filled';
    }

    elseif (!preg_match($regex_mail, $sender))
    {
      $alert = 'adress '.$sender.'  is not valid';
    }

    elseif (preg_match($regex_head, $sender) 
            || preg_match($regex_head, $name) 
            || preg_match($regex_head, $message))
    {
        $alert = 'Headers prohibited in the form fields';
    }

    elseif (!isset($_COOKIE['sent']))
    {
      
        $to = '[email protected]';
 		$object = "Join the project ";
        $message  = 'Hello Yassin,'."\r\n\r\n";
		
	     $message .= "This email was sent from page apply ma page by  : ".$_POST['civility']." ".$_POST['name']." ".$_POST['prenom']."\r\n";
		
        $message .= 'Here is the message that is sent to you :'."\r\n";
		
		$message .= "nationality : ".$_POST['nationality']."\r\n";

		$message .= 'date of  : '.$_POST['jour'].' '.$_POST['mois'].''.$_POST['annee']."\r\n\r\n";
		$message .= "tel : ".$_POST['tel']."\r\n";
		
		$message .= "adress : ".$_POST['adress']."\r\n";
	    $message .= "city : ".$_POST['city']."\r\n";
		
		$message .= "Zip : ".$_POST['zip']."\r\n";
		
		
		$message .= "Country : ".$_POST['Country']."\r\n";
		$message .= "Preferred project :: ".$_POST['project']."\r\n";
		
		$message .= "Study or profession  : ".$_POST['sty']."\r\n";
		
	    $message .= "Work experience : ".$_POST['work']."\r\n";
		
		$message .= "Native Language : ".$_POST['native']."\r\n";
		
		
		 $message .= "First Foreign Language :".$_POST['first']."\r\n";
		
		$message .= "Level  : : ".$_POST['levelfirst']."\r\n";
		
		
		$message .= "Second Foreign Language : ".$_POST['second']."\r\n";
		
		$message .= "Level  : ".$_POST['levelsecond']."\r\n";
	    $message .= "Other Languages :  ".$_POST['otherlanguages']."\r\n";
		
		$message .= "Level  : ".$_POST['levelother']."\r\n";
		
	    $message  .= 'Why did you choose this project ? :'."\r\n";
		$message .= "in writing : ".$_POST['choose']."\r\n";
		
		 $message  .= 'Why do you want to participate in a workcamp ? :'."\r\n";
		$message .= "in writing : ".$_POST['participate']."\r\n";

        $message  .= 'Why do you want to do voluntary work in Morocco ?:'."\r\n";
		$message .= "in writing : ".$_POST['voluntary']."\r\n";

        $message  .= 'Do you have any travel experience ?:'."\r\n";
		$message .= "in writing : ".$_POST['travel']."\r\n";

	    $message .= 'How did you find us ? : :'."\r\n";
		$message .= "in writing : ".$_POST['findus']."\r\n";
		
     
           $message = wordwrap($message, 70);  
		

          
 

        $headers = 'From: '.$name.'. '.$sender.''."\r\n\r\n";
     
        if (mail($to,$object, $message, $headers))
        {
            $alert = 'Your message have been sent ! We will get you back as soon as possible, Thank you';
 
    
         
 

            unset($_POST);
        }
        else
        {
            $alert = 'Your message was not sent, please try again !';
        }
 
    }
  
    else
    {
        unset($_POST);
    }
}
?>

Re: probléme d envoie de formulaire a un email

Posté : 11 déc. 2013, 23:25
par moogli
Modération :
Afin d'améliorer la lisibilité de ton message,
pense à utiliser les balises [code] ou [php] (selon le langage utilisé).

Elles sont disponibles au-dessus de la zone de saisie de ton message
lorsque tu postes un nouveau message.

Des indications sont disponibles sur la manière de mettre en forme vos messages dans la FAQ



Tu n'affiche rien, donc ce que tu indique semble normal.
utilise la fonction echo pour afficher ton message !

@+