Page 1 sur 1

résultat du formulaire sous forme de devis

Posté : 20 sept. 2010, 09:46
par legrosdu93
Bonjour,
Je viens de créer ma première page php et ma fois je ne suis pas mécontent mais j'aimerais désormais l'améliorée.
Je vous explique, ma page PHP est enfaite un formulaire où la personne entre les différents besoins du client (en effet la page php est à usage interne) et j'aimerais donc créer un bouton du style aperçu qui renverrais vers une autre page en récapitulant les besoins mais cette fois ci sous forme de devis car pour le moment les besoins sont récapitulés sur la même page.
J'espere avoir été clair mais je reste sur le forum pour de plus amples informations.
Merci de votre aide.
aperçu de ma page
<html>
<head>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
   <head>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
   </head>
   
</html>
<body>
<form name="formulaire" method="post" action="frames.php">

<table width="100%">
<tr bgcolor=darkblue ><td colspan="3" align="center" ><font face color='#ffffff'> Entrez les données suivantes</font></td></tr>
<tr><td bgcolor="lightblue"><br />
    <p>Nombre de sirène interne <a href="http://localhost/PHP/DOC/com-SIMAX.pdf">DOC</a> :</p> <input type="text" name="sireneint"/> <br/>
	<p>Nombre de sirène externe <a href="http://localhost/PHP/DOC/com-SIREX.pdf">DOC</a> :</p> <input type="text" name="sireneext"/> <br/>
        <p>Nombre de clavier <a href="http://localhost/PHP/DOC/NOVEAU CLAVIER SAK84 SINTONY.pdf">DOC</a> : </p> <input type="text" name="clavier"/> <br/>
		<p>Nombre d'utilisateur : </p> <input type="text" name="utilisateur"/> <br/>
		<p>Nombre de secteur :</p>  <input type="text" name="secteur"/> <br/>
		
		<p>Télésurveillance (oui / non): </p> <select name="tele">
									  <option value="oui">oui</option>
									  <option value="non">non</option>
									  </select>
		<br />
		<br />			
	<br />
		<br /> 
		
		<td width="100%" align="center">
<?php

header("content-type=itc/jpg");

    foreach ($_POST as $post) //cette boucle permet de mettre à zéro tous les champs qui n'ont pas été remplis
			{
			if (empty($post))
			$post = 0;
			}
			
	
			if(isset($_POST['valider'])){
            $sireneint=$_POST['sireneint'];
            $sireneext=$_POST['sireneext'];
            $clavier=$_POST['clavier'];
			$infrarouge=$_POST['infrarouge'];
			$double=$_POST['double'];
			$longue=$_POST['longue'];
			$porte=$_POST['porte'];
			$ouverture=$_POST['ouverture'];
			$rinfrarouge=$_POST['rinfrarouge'];
			$rouverture=$_POST['rouverture'];
			$utilisateur=$_POST['utilisateur'];
			$secteur=$_POST['secteur'];			
			$tele=$_POST['tele'];
			
						
			$ef = $infrarouge + $double + $longue + $porte + $ouverture + $sireneint + $sireneext;
			$radio = $rinfrarouge + $rouverture;
			
									
			if (($ef <= 22)and($radio==0)and($clavier<4)and($secteur<3)and($utilisateur<21))
			{
				$variable= 'petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>';
			}
			else
			{
				if ( ($ef <= 10) and ($radio >= 1)and($radio<=12)and($clavier<4)and($secteur<3)and($utilisateur<21))
				{
					$variable = 'petite centrale<a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>';
				}
				else
				{
					if (($ef>=48)or(($ef>=36)and($radio>=12))or(($ef>=24)and($radio>=24))or(($ef>=12)and($radio>=36))or($clavier>7)or($secteur>6)or($utilisateur>49))
					{
						$variable = 'grande centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>';
					}
					else
					{
						$variable = 'moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>';
					}
					
					
				}				
				
			}
			
						
			
			echo  $variable ;
			
			
				if ($variable== 'petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>')
					{
						echo '<br />prévoir batterie 12V 7A 76156A<br />';
					}
				else
					{	
						 echo '<br />prévoir batterie 12V 18A 40195<br />';
					}
				
							
				if ($tele=='oui')
					{
						echo '<br />prévoir abonnement<br />'; 
					}
					else
					{
						echo '';
					}
				if	(($radio)and($variable=='petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
					{
						echo '<br /> +1transpondeur radio RAR22F<br />';
					}
					
				if (($ef>6) and ($ef<11)and($variable=='petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +1 transpondeur SAT12<br />';
				}
				elseif (($ef>10)and($ef<15)and($variable=='petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +2 transpondeurs SAT12<br />';
				}
				elseif (($ef>14)and($ef<19)and($variable=='petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +3 transpondeurs SAT12<br />';
				}
				elseif (($ef>18)and($ef<=22)and($variable=='petite centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +4 transpondeurs SAT12<br />';
				}
				
				if (($ef>8)and($ef<13)and($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +1 transpondeur SAT12<br />';
				}
				
				
				if (($ef>12)and($ef>17)and($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +2 transpondeurs SAT12<br />';
				}
				
				if (($ef>16)and($ef>21)and($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +3 transpondeurs SAT12<br />';
				}
				
				if (($ef>20) and ($ef<25)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +4 transpondeurs SAT12<br />';
				}
				
				if (($ef>24) and ($ef<29)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +5 transpondeurs SAT12<br />';
				}
				
				if (($ef>28) and ($ef<33)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +6 transpondeurs SAT12<br />';
				}
				
				if (($ef>32) and ($ef<37)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +7 transpondeurs SAT12<br />';
				}
				
				if (($ef>36) and ($ef<41)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +8 transpondeurs SAT12<br />';
				}
				
				if (($ef>40) and ($ef<45)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +9 transpondeurs SAT12<br />';
				}
				
				if (($ef>44) and ($ef<=48)and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +10 transpondeurs SAT12<br />';
				}
				
						
				if (($radio>=1)and ($radio<13) and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +1 transpondeur radio RAR22F<br />';
				}
				if (($radio>=12)and ($radio<25) and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +2 transpondeurs radio RAR22F<br />';
				}
				if (($radio>=24)and ($radio<=36) and ($variable=='moyenne centrale <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_SINTONY.pdf">DOC</a>'))
				{
					echo '<br /> +3 transpondeurs radio RAR22F<br />';
				}
				
				
				if(($sireneext)or($sireneint))
				{
					echo '<br /> Prévoir batterie 12V 2A BAT02<br/>';
				}
				
				
			if($sireneint)
			{
				echo  $sireneint.'sirène(s) interne SIMAX <a href="http://localhost/PHP/DOC/com-SIMAX.pdf">DOC</a> <br/>';
			}
			if($sireneext)
			{
				echo  $sireneext.'sirène(s) externe SIREXF<a href="http://localhost/PHP/DOC/com-SIREX.pdf">DOC</a><br/>';
			}	
			
			if($clavier)
			{
				echo $clavier.'clavier(s) SAK84 <a href="http://localhost/PHP/DOC/NOVEAU CLAVIER SAK84 SINTONY.pdf">DOC</a><br/>'; 
			}
				
			if($infrarouge)
			{
				echo $infrarouge.'détecteur(s) infrarouge IR120C<a href="http://localhost/PHP/DOC/FICHE_PRODUIT_IR120C.pdf">DOC</a><br/>';
			}	
			if($double)
			{
				echo $double.'détecteur(s) double technologie IRM120<a href="http://localhost/PHP/DOC/IRM120C-2.pdf">DOC</a><br/>';
			}
			if($longue)
			{
				echo $longue.'détecteur(s) longue portée DS778<a href="http://localhost/PHP/DOC/DS778_LONGUEPORTEE.pdf">DOC</a><br/>';
			}
			if($porte)
			{
				echo$porte.'sabot(s) de porte IM1740<a href="http://localhost/PHP/DOC/DS-FR-MM740.pdf">DOC</a><br/>';
			}
			if($ouverture)
			{
				echo  $ouverture.'contact(s) d\'ouverture<a href="http://localhost/PHP/DOC/im9700.pdf">DOC</a><br/>';
			}
			if ($rinfrarouge)
			{
				echo$rinfrarouge.'détecteur(s) radio RAIR27<a href="http://localhost/PHP/DOC/RAIR270.pdf">DOC</a><br/>';
			}
			if ($rouverture)
			{
				echo $rouverture.'contact(s) d\'ouverture radio RAMC22<a href="http://localhost/PHP/DOC/RAMC22.pdf">DOC</a><br/>';
			}
			
			
		
				
		}
		
?>  
    </td>
    <td bgcolor="lightblue">
	<h3>Matériel filaire </h3>
									  
		<p>Détecteur infrarouge (12m) <a href="http://localhost/PHP/DOC/FICHE_PRODUIT_IR120C.pdf">DOC</a> : </p> <input type="text" name="infrarouge"/> <br/>
		<p>Détecteur Double technologie (12m) <a href="http://localhost/PHP/DOC/IRM120C-2.pdf">DOC</a>:</p> <input type="text" name="double"/> <br/>
		<p>Détecteur longue portée (18m) <a href="http://localhost/PHP/DOC/DS778_LONGUEPORTEE.pdf">DOC</a> :</p> <input type="text" name="longue"/> <br/>
		<p>Sabot de porte <a href="http://localhost/PHP/DOC/DS-FR-MM740.pdf">DOC</a>:</p>  <input type="text" name="porte"/> <br/>
		<p>Contact d'ouverture <a href="http://localhost/PHP/DOC/im9700.pdf">DOC</a>:</p> <input type="text" name="ouverture"/> <br/>				
		
		<h3>Matériel radio </h3>
		
		<p>Détecteur <a href="http://localhost/PHP/DOC/RAIR270.pdf">DOC</a> :</p>  <input type="text" name="rinfrarouge"/> <br/>
		<p>Contact d'ouverture <a href="http://localhost/PHP/DOC/RAMC22.pdf">DOC</a> :</p> <input type="text" name="rouverture"/> <br/>
		
	</td>
</tr>
<tr bgcolor="darkblue">
    <td colspan="3" align="center"><input type="submit" name="valider" value="Configuration"/></td>
</tr>

<tr bgcolor="lightblue">
	
	<td colspan="6" align="center"><input type="submit" name="devis" value="aperçu"/> <a href="test.php">aperçu</a> 
	
	<form method="POST" action="test.php">

<input type="submit" name="devis" value="aperçu"/>
</form></td>
</tr>

</table>
</body>
</html>
         

Re: résultat du formulaire sous forme de devis

Posté : 20 sept. 2010, 14:57
par gialex
Bonjour, :)

Hum... Si j'ai bien compris, il suffit que lorsque l'utilisateur clique pour obtenir son aperçu, tu fasses passer toutes les données en $_POST par un formulaire vers la page d'aperçu, non ?

Re: résultat du formulaire sous forme de devis

Posté : 20 sept. 2010, 15:09
par AB
La page aperçu est identique à une page "normale" excepté que les données ne sont pas enregistrées en bdd (ou sont enregistrées mais sans être affichées donc avec un champ dans la bdd réservé à cet effet).

Il te faut donc faire une page normale telle que tu voudrais la voir afficher au final, et cette page sera alimentée par tes données $_POST envoyées par le formulaire. Ces données $_POST peuvent être enregistrées dans une variable de session pour facilité leur affichage en évitant l'inconvénient d'un double post en cas d'un rafraichissement de la page.

Re: résultat du formulaire sous forme de devis

Posté : 21 sept. 2010, 14:23
par legrosdu93
Merci pour cette réponse je vais essayer ca de suite