Bonjour tout le mande;
j'ai un petit soucis dans un formulaire sur mon site; voila la situation:
j'ai 2 fichiers php
1; form.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<form method="post" action="test.php"><table width="475" border="0" cellspacing="0">
  <tr>
    <td width="225">Nom<span class="Style1">*</span> : </td>
    <td width="246"><input size="30" type="text" name="nom"  />
</td>
  </tr>
  <tr>
    <td>Pr&eacute;nom<span class="Style1">*</span> : </td>
    <td><input size="30" type="text" name="prenom" />
</td>
  </tr>
  <tr>
    <td>Soci&eacute;t&eacute;<span class="Style1">*</span> : </td>
    <td><input size="30" type="text" name="societe" /></td>
  </tr>
  <tr>
    <td>Fonction : </td>
    <td><input size="30" type="text" name="fonction" /></td>
  </tr>
  <tr>
    <td>E-mail<span class="Style1">*</span> : </td>
    <td><input size="30" type="text" name="email" /></td>
  </tr>
  <tr>
    <td>T&eacute;l&eacute;phone<span class="Style1">*</span> : </td>
    <td><input size="30" type="text" name="tele" /></td>
  </tr>
  <tr>
    <td>Objectif de votre email<span class="Style1">*</span> : </td>
    <td><input size="30" type="text" name="objectif" /></td>
  </tr>
  <tr>
    <td>Votre message<span class="Style1">*</span> : </td>
    <td><textarea width="160" name="message" rows="5" cols="23" ></textarea></td>
  </tr>
  <tr>
    <td>
      <span class="Style1">*</span> Champs Obligatoires</td>
    <td ><input type="submit" name="envoyer" value="Envoyer" /></td>
  </tr>
</table></form>
et test.php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
if (!isset($_POST['nom']) || $_POST['nom']=='') {
$nom = "Ce champ doit être renseigné.";
header('location:contact.php');
}
else {
    if (!isset($_POST['prenom']) || $_POST['prenom']=='') {
    $prenom = "Ce champ doit être renseigné.";
    header('location:contact.php');
    }
	else { 
	      if (!isset($_POST['societe']) || $_POST['societe']=='') {
	      $societe = "Ce champ doit être renseigné.";
          header('location:contact.php');
          }	 
		  else {
		        if  (!isset($_POST['email']) || $_POST['email']=='') {
				$email = "Ce champ doit être renseigné.";
                header('location:contact.php');
                }	
				else {
				     if (!isset($_POST['tele']) || $_POST['tele']=='') {
					 $tele = "Ce champ doit être renseigné.";
                     header('location:contact.php');
                     }
					 else {
					      if (!isset($_POST['objectif']) || $_POST['objectif']=='') {
					      $objectif = "Ce champ doit être renseigné.";
                          header('location:contact.php');
                          }
					      else {
						       if (!isset($_POST['message']) || $_POST['message']=='') {
							   $objectif = "Ce champ doit être renseigné.";
                               header('location:contact.php');
                               }
else {
?>
<html>
<body>.....</body>
</html>
<?php }}}}}}} ?>
mon problème est:
je veux; après que je clique sur "envoyer", les informations serrent envoyer vers test.php (jusqu'au là pas de soucis) puis sur test.php y a une vérification des donnes entrer par l'utilisateur (es ce qu'il a bien remplis tout les champs * ou pas; aussi jusqu'au là pas de problème)
mais lorsque l'utilisateur oublier de remplis un champs * il y a une redirection vers la première page form.php; alors moi je veux mettre sous le champs non remplis un message: "ce champs est obligatoire"
merci bien de votre aide..