示例#1
0
} else {
    if (isset($numeroDeKm)) {
        $bici->recorre($numeroDeKm);
    }
}
?>
        <h2>Soy el Coche he recorrido <?php 
echo $coche->getKilometraje();
?>
 Kms.</h2>
        <h2>Soy la bici he recorrido <?php 
echo $bici->getKilometraje();
?>
 Kms.</h2>
        <h2>Total km Recorridos <?php 
echo Vehiculo::getKilometrajeTotal();
?>
 Kms.</h2>
        <form action="Ejercicio04.php" method="POST" id="vehiculos">
            No de Kms:
            <input type="number" name="numeroDeKm" min="1">
            <input type="submit">
        </form>

        <select name="vehiculo" form="vehiculos">
            <option value="coche">Coche</option>
            <option value="bici">Bici</option>
        </select>
        <?php 
$_SESSION['coche'] = serialize($coche);
$_SESSION['bici'] = serialize($bici);