ok :
le script Php
<?
switch($_POST['Action']):
case "save":
$error = false;
if (!$_POST['title']):
$error_title = "Please select your title";
$error = true;
endif;
if (!$_POST['firstname']):
$error_firstname = "Please enter your firstname";
$error = true;
endif;
if (!$_POST['surname']):
$error_surname = "Please enter your surname";
$error = true;
endif;
if (!$_POST['address1']):
$error_address = "Please enter the first line of your address";
$error = true;
endif;
if (!$_POST['city']):
$error_city = "Please enter your city";
$error = true;
endif;
if (!$_POST['postcode']):
$error_postcode = "Please enter your postcode";
$error = true;
endif;
if (!$_POST['country']):
$error_country = "Please select your country";
$error = true;
endif;
if ((!$_POST['email']) || (strpos($_POST['email'], '@') == 0)):
$error_email = "Please enter your email";
$error = true;
endif;
if (!$_POST['telephone']):
$error_telephone = "Please enter your telephone (landline). If you don't have a landline, please enter your mobile number in THIS field, or write 'NONE'";
$error = true;
endif;
if (!$_POST['comments']):
$error_comments = "Please enter the details of your enquiry";
$error = true;
endif;
// send email
mail("$_POST[email]", "Your Language Trainers Enquiry has been received",
"Dear $_POST[firstname],\n\nThank you for your enquiry.\n
--------------------------------------------------------------------------------
Kind Regards
Guillaume Busetto
email: guillaume@listenandlearn.org
-------------------------------------------------------------------------------
Listen and learn
Brighton Media Centre
",
"From: guillaume@listenandlearn.org\nX-Mailer: PHP/" . phpversion());
mail("guillaume@listenandlearn.org", "Listen and learn Online Enquiry",
"Name: $_POST[title] $_POST[firstname] $_POST[surname]\n
Organisation: $_POST[organisation]\n
Position: $_POST[position]\n
Address: $_POST[address1], $_POST[address2], $_POST[city], $_POST[county], $_POST[postcode], $_POST[country]\n
Website: $_POST[website]\n
Nature of Business: $_POST[nature_of_business]\n
Phone (landline): $_POST[landline]\n
Phone (mobile): $_POST[mobile]\n
Fax: $_POST[fax]\n
Languages to learn: $_POST[languagestolearn]\n
Where did they hear about us: $_POST[refer]\n
Comments: $_POST[comments]\n
--------------------------------------------------------------------------------
", "From: $_POST[email]\nX-Mailer: PHP/" . phpversion());
redirect("confirmation.php" );
else:
$msg = "<hr><b>*You have not entered all the required information*</b><hr>";
endif; // if (!$error):
break;
endswitch;
?>
maintenant le formulaire dans le corps :
<form action="<?PHP echo $PHP_SELF; ?>" method="post" name="questionnaire">
<table width="90%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Title
* <strong><? echo $error_title; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<select name="title">
<option value="">Select</option>
<? // display all titles in globals.custom.php
while (list ($key, $val) = each ($_TITLE)):
unset($selected);
if($val == $_POST['title']) $selected="selected";
echo "<option $selected>$val</option>\n";
endwhile;
?>
</select>
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>First
name *<strong><? echo $error_firstname; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="firstname" size="25" maxlength="200" value="<? echo $_POST['firstname']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Surname
* <strong><? echo $error_surname; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="surname" size="25" maxlength="200" value="<? echo $_POST['surname']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Address
* <strong><? echo $error_address; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input name="address1" type="text" id="address1" size="25" value="<? echo $_POST['address1']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td valign="middle"> <p><font color="#000000"></font></p></td>
<td> <p> <span class="generaltxt"><font color="7f7978">
<input name="address2" type="text" id="address2" size="25" value="<? echo $_POST['address2']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Town
or City * <strong><? echo $error_city; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="city" size="25" maxlength="200" value="<? echo $_POST['city']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000">County</font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="county" size="25" maxlength="200" value="<? echo $_POST['county']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Postcode
* <strong><? echo $error_postcode; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="postcode" size="25" maxlength="200" value="<? echo $_POST['postcode']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>Country*
<strong><? echo $error_country; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<select name="country">
<option value="">Select</option>
<? // display all titles in globals.custom.php
while (list ($key, $val) = each ($_COUNTRY)):
unset($selected);
if($val == $_POST['country']) $selected="selected";
echo "<option $selected>$val</option>\n";
endwhile;
?>
</select>
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><b>e-mail*
<strong><? echo $error_email; ?></strong> </b></font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="email" size="25" maxlength="200" value="<? echo $_POST['email']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td valign="middle"> <p class="generaltxt"><font color="#000000">Type
of Business</font></p></td>
<td> <p> <span class="generaltxt"><font color="7f7978">
<input type="text" name="nature_of_business" size="25" maxlength="200" value="<? echo $_POST['nature_of_business']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%" valign="middle"> <p class="generaltxt"><font color="#000000"><strong>Telephone
(landline)*<br>
</strong> <em>include country and city code</em> <strong>
<? echo $error_telephone; ?></strong> </font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<input name="telephone" type="text" id="telephone" size="25" maxlength="200" value="<? echo $_POST['telephone']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td valign="middle"> <p class="generaltxt"><font color="#000000">Telephone
(mobile)<strong><br>
</strong> <em>include country and city code</em></font></p></td>
<td> <p> <span class="generaltxt"><font color="7f7978">
<input name="mobile" type="text" id="mobile" size="25" maxlength="200" value="<? echo $_POST['mobile']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td valign="middle"> <p class="generaltxt"><font color="#000000">Fax<strong><br>
</strong> <em>include country and city code</em><br>
</font> </p></td>
<td> <p> <span class="generaltxt"><font color="7f7978">
<input name="fax" type="text" id="fax" size="25" maxlength="200" value="<? echo $_POST['fax']; ?>">
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td width="47%"> <hr> </td>
<td width="53%"> <hr> </td>
</tr>
<tr class="generaltxt">
<td valign="middle" width="47%"> <p class="generaltxt"><font color="#000000"><strong>Comments*</strong>
<strong><br>
<? echo $error_comments; ?></strong> </font></p></td>
<td width="53%"> <p> <span class="generaltxt"><font color="7f7978">
<textarea name="comments" cols="30" rows="15"><? echo $_POST['comments']; ?></textarea>
</font></span></p></td>
</tr>
<tr class="generaltxt">
<td valign="top"> </td>
<td> </td>
</tr>
<tr class="generaltxt">
<td colspan="2" valign="top"> <div align="right">
<p class="generaltxt"><font color="7f7978">
<input type="hidden" name="Action" value="save">
<span class="generaltxt">
<input type="submit" name="Submit" value="send a message to listen and learn " class="button">
</span> </font></p>
</div></td>
</table>
</table>
</form>