Pagine

mercoledì 8 giugno 2011

USO DELLE COMBOBOX

SCELTA DELLA MACCHINA

Parte HTML

<html>
<head>
<title>Scelta di una macchina</title>
</head>
<body>
<font face="comic sans ms" color="white">
<h2><center>Scelta della macchina</center></h2>
<form action="scelta_macchina.php" method="POST">
<body bgcolor="red">
MACCHINA: <select name="mtipo">
<option value="FIAT500"> Fiat 500
<option value="BMWX6"> BMW X6
<option value="AUDIQ7"> Audi Q7
</select><p>

<hr width=650>
<h2><center>Scelta del colore</h2></center>
<input type="radio" name="tcolore" value="rosso" checked> Rosso<p>
<input type="radio" name="tcolore" value="bianco"> Bianco<p>
<input type="radio" name="tcolore" value="nero"> Nero<p>
<input type="radio" name="tcolore" value="grigio"> Grigio<p>
<input type="radio" name="tcolore" value="blu"> Blu<p>
<hr width=650>
<h2><center>Scelta dei cerchi</h2></center>
<input type="radio" name="tcerchi" value="normali" checked> Cerchi normali<p>
<input type="radio" name="tcerchi" value="in lega"> Cerchi in lega<p>
<hr width=650>
<h2><center>Scelta degli optional</h2></center>
<input type="checkbox" name="ton" value="navigatore" checked> Navigatore<p>
<input type="checkbox" name="toa" value="fari antinebbia"> Fari antinebbia<p>
<input type="checkbox" name="tox" value="fari xeon"> Fari allo xeon<p>
<input type="checkbox" name="toap" value="airbag passeggiero"> Airbag passeggiero<p>
<input type="checkbox" name="toal" value="airbag laterali"> Airbag laterali<p>
<input type="checkbox" name="toac" value="aria condizionata"> Aria condizionata<p>
<input type="checkbox" name="tob" value="bluethoot"> Bluethoot<p>
<input type="checkbox" name="toar" value="autoradio"> Autoradio con lettore cd o usb<p>
<input type="checkbox" name="tov" value="vetrielettrici"> Vetri elettreci posteriori<p>
<input type="submit" value="Invia">
<input type="reset" value="Cancella">
</font>
</form>
</body>
</html>
Parte PHP

<html>
<head>
<title>Scelta di una macchina</title>
</head>
<body bgcolor="red">
<font face="Comic sans ms" color="white">
<center><h2><b>RIEPILOGO DATI SCELTI</b></center></h2>
<?php
//Inizializzazione delle variabili
$mtipo=$_POST['mtipo'];
$tcolore=$_POST['tcolore'];
$tcerchi=$_POST['tcerchi'];

echo "Desiderate acquistare un'automobile modello $mtipo di colore $tcolore e con cerchi $tcerchi. <p>";
//Inizializzazione delle variabili
$ton=$_POST['ton']; $toa=$_POST['toa']; $tox=$_POST['tox']; $toap=$_POST['toap']; $toal=$_POST['toal']; $toac=$_POST['toac']; $tob=$_POST['tob']; $toar=$_POST['toar']; $tov=$_POST['tov'];

echo "Avete deciso di avere sulla vostra automobile i seguenti optional:<p>";

if($ton=="" and $toa=="" and $tox=="" and $toap=="" and $toal=="" and $toac=="" and $tob=="" and $toar=="" and $tov=="")
echo "Non avete scelto optional per la vostra automobile.<p>";
else

if($ton)
echo "$ton <p>";
if($toa)
echo "$toa <p>";
if($tox)
echo "$tox <p>";
if($toap)
echo "$toap <p>";
if($toal)
echo "$toal <p>";
if($toac)
echo "$toac <p>";
if($tob)
echo "$tob <p>";
if($toar)
echo "$toar <p>";

if($tov)
echo "$tov <p>";
?>
</font>
</body>
</html>

Nessun commento:

Posta un commento