[PHP-JS] Champs en plus ou en moins
Bonjour. alors voilà j'ai pour l'instant un formulaire simple avec vérification des champs :
Code:
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| <form name="forml" method="post" action="<?php echo $_SERVER['PHP_SELF'].'?lang='.$lang; ?>">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="w1"><?php echo nom; ?></td>
<td><input name="nom" type="text" id="nom" value="<?php echo $nom ; ?>"><span class="obl">*</span></td>
</tr>
<tr>
<td><?php echo prenom; ?></td>
<td><input name="prenom" type="text" id="prenom" value="<?php echo $prenom ; ?>"><span class="obl">*</span></td>
</tr>
<tr>
<td><?php echo societe; ?></td>
<td><input name="societe" type="text" id="societe" value="<?php echo $societe ; ?>"></td>
</tr>
<tr>
<td><?php echo mail; ?></td>
<td><input name="email" type="text" id="email" value="<?php echo $email ; ?>"><span class="obl">*</span></td>
</tr>
<tr>
<td><?php echo sujet; ?></td>
<td><input name="sujet2" type="text" id="sujet2" value="<?php echo $sujet2 ; ?>"><span class="obl">*</span></td>
</tr>
<tr>
<td><?php echo message; ?></td>
<td><textarea name="mess" cols="60" rows="7" id="mess"><?php echo $mess ; ?></textarea><span class="obl">*</span></td>
</tr>
<tr>
<td> </td>
<td><span class="obl">* <?php echo champobl; ?></span></td>
</tr>
</table>
<table cellpadding="2" cellspacing="0">
<tr>
<td class="centre" ><input name="Annuler" type="reset" id="Annuler2" value="<?php echo annule; ?>">
<input type="hidden" name="action" value="submitted">
<input name="Envoyer" type="submit" id="Envoyer2" value="<?php echo envoie; ?>">
</td>
</tr>
<tr>
<td class="centre">
<?php
if($_POST['action'] == 'submitted') {
if((empty($nom ))
||(empty($prenom ))
||(empty($sujet2 ))
||(empty($mess ))
||(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$email)))
echo error;
else
{
$adress = "web@strix.fr";
$sujet = "$_POST[sujet2]";
$from = "From: ".$_POST[email]."\n";
$from .= "MIME-version: 1.0\n";
$from .= "Content-type: text/html; charset= iso-8859-1\n";
$message="
$_POST[nom] $_POST[prenom]<br>
$_POST[societe]<br>
$_POST[email]<br><br>
$_POST[sujet2]<br>
$_POST[mess]";
mail($adress, $sujet, $message, $from);
echo ok;
echo '<meta http-equiv="Refresh" content="3; URL=accueil.php?lang=' . $lang . '">';
}
}
?>
</td>
</tr>
</table>
</form> |
Mais je trouve pas ça assez compliqué ! :aie:
Alors voilà ce que j'aimerais faire : un lien type texte ("Devis PAO" par exemple) qui une fois cliqué rajouterai tout une partie à mon formulaire (champs etc) ainsi que bien sûr la vérification des nouveaux champs...
Sachant qu'après j'aimerais encore rajouté une nouvelle partie.
J'aimerais que si la personne venait à supprimer cette partie, elle soit prévenue que les informations données vont être éffacées.
Alors avant de me lancer... est-ce facile ou non ? Vais-je devoir changer tout mon code existant ?
Merci d'avance