Hi Ben,
Here is all the php code I used :
The "<select name="delai" id="delai">" line indicates a syntax error. I tried to put it somewhere else with the same result...
Here is the html for the dropdown :
Thanks once again
Here is all the php code I used :
PHP Code:
<?php require_once("/home/a5060614/public_html/formtools_2.1.0._Beta/global/api/api.php");
$fields = ft_api_init_form_page(2);
// validation time!
$errors = array();
if (isset($_POST['Submit']))
{
$rules = array();
$rules[] = "required,nom,Veuillez entrer votre nom / Please enter your name";
$rules[] = "required,email,Veuillez entrer votre adresse email / Please enter your email address";
$rules[] = "valid_email,email,Veuillez entrer une adresse email valide / Please enter a valid email address";
$rules[] = "required,code_postal,Veuillez indiquer votre code postal / Please enter your zip code";
$rules[] = "digits_only,code_postal,Votre code postal ne doit comporter que des chiffres / Your zip code should only contain digits";
$rules[] = "required,pays,Veuillez indiquer votre pays / Please enter your country of residence";
$rules[] = "required,type,Veuillez indiquer le type de travaux que vous désirez / Please enter the kind of work you want";
$rules[] = "required,delai,Veuillez indiquer le délai que vous désirez / Please enter the deadline for your work";
$errors = validate_fields($_POST, $rules);
// no errors - great! Now we process the page. The ft_api_process_form does
// the job of both updating the database and redirecting to the next page
if (empty($errors))
{
$params = array(
"submit_button" => "Submit",
"next_page" => "Merci.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
}
// it failed validation. Update $fields with the latest contents of the form data
else
{
$fields = array_merge($_SESSION["form_tools_form"], $_POST);
<select name="delai" id="delai">
<option value="" <?php if (@$fields["delai"] == "") echo "selected"; ?>></option>
<option value="1 semaine" <?php if (@$fields["delai"] == "1 semaine") echo "selected"; ?>>1 semaine</option>
<option value="1 mois" <?php if (@$fields["delai"] == "1 mois") echo "selected"; ?>>1 mois</option>
<option value="Plus" <?php if (@$fields["delai"] == "Plus") echo "selected"; ?>>Plus</option>
</select>
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr-fr">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>Demande de devis</title>
<link media="all" type="text/css" rel="stylesheet" href="CommTat.css" />
</head>
<body>
<?php // if $errors is not empty, the form must have failed one or more validation
// tests. Loop through each and display them on the page for the user
if (!empty($errors))
{
echo "<div class='error'>Veuillez résoudre les erreurs suivantes :\n<ul>";
foreach ($errors as $error)
echo "<li>$error</li>\n";
echo "</ul></div>";
}
?>
The "<select name="delai" id="delai">" line indicates a syntax error. I tried to put it somewhere else with the same result...
Here is the html for the dropdown :
Code:
<select name="delai" id="delai">
<option value=""></option>
<option value="1 semaine">1 semaine</option>
<option value="1 mois">1 mois</option>
<option value="Plus">Plus</option>
</select>
Thanks once again