Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Richiamare radio selezionata

    Salve ragazzi ho questo codice:

    File calcola.php
    if($camere==1){ //camera delux
    for($i=0; $i < count($prova);$i++){
    $contbeb1=0;$contbeb2=0;$contbeb3=0;$contbeb4=0;$c ontbeb5=0;$contbeb6=0;
    if ($prova[$i] >= strtotime ($anno."-01-01") and $prova[$i] <= strtotime ($anno."-06-26")) $contbeb1 = 110;
    if ($prova[$i] >= strtotime ($anno."-06-27") and $prova[$i] <= strtotime ($anno."-07-10")) $contbeb2 = 125;
    if ($prova[$i] >= strtotime ($anno."-07-11") and $prova[$i] <= strtotime ($anno."-08-07")) $contbeb3 = 150;
    if ($prova[$i] >= strtotime ($anno."-08-08") and $prova[$i] <= strtotime ($anno."-08-23")) $contbeb4 = 170;
    if ($prova[$i] >= strtotime ($anno."-08-24") and $prova[$i] <= strtotime ($anno."-09-06")) $contbeb5 = 125;
    if ($prova[$i] >= strtotime ($anno."-09-07") and $prova[$i] <= strtotime ($anno."-12-31")) $contbeb6 = 110;
    $totbebperiodo =$totbebperiodo +($contbeb1 + $contbeb2 + $contbeb3 + $contbeb4 + $contbeb5+ $contbeb6);
    }//chiusura for

    $tot = $totbebperiodo;
    ?>
    <form action="invia.php" method="post"
    <tr>
    <td><img src="icona2.jpg" alt="hotel"></td>
    <td> Camera Delux (Appartamento) </td>
    <td> Prezzo: € <?php echo "".$tot ?></td>
    <td> <input type="radio" name="prenota" value="delux" checked>
    </td>
    </tr>


    <?php
    $totbebperiodo=0;
    for($i=0; $i < count($prova);$i++){
    $contbeb1=0;$contbeb2=0;$contbeb3=0;$contbeb4=0;$c ontbeb5=0;$contbeb6=0;
    if ($prova[$i] >= strtotime ($anno."-01-01") and $prova[$i] <= strtotime($anno."-06-26"))$contbeb1 = 101;
    if ($prova[$i] >= strtotime ($anno."-06-27") and $prova[$i] <= strtotime ($anno."-07-10")) $contbeb2 = 115;
    if ($prova[$i] >= strtotime ($anno."-07-11") and $prova[$i] <= strtotime ($anno."-08-07")) $contbeb3 = 140;
    if ($prova[$i] >= strtotime ($anno."-08-08") and $prova[$i] <= strtotime ($anno."-08-23")) $contbeb4 = 160;
    if ($prova[$i] >= strtotime ($anno."-08-24") and $prova[$i] <= strtotime ($anno."-09-06")) $contbeb5 = 115;
    if ($prova[$i] >= strtotime ($anno."-09-07") and $prova[$i] <= strtotime ($anno."-12-31")) $contbeb6 = 101;
    $totbebperiodo =$totbebperiodo +($contbeb1 + $contbeb2 + $contbeb3 + $contbeb4 + $contbeb5+ $contbeb6);
    }//chiusura for

    $tot = $totbebperiodo;
    ?>

    <tr>
    <td><img src="icona2.jpg" alt="hotel"></td>
    <td> Camera Quadrupla Standard (Matrimoniale + 2 letti aggiunti) </td>
    <td> Prezzo: € <?php echo "".$tot ?></td>
    <td> <input type="radio" name="prenota" value="quadrupla_standard">
    </td>
    </tr>

    <?php

    }//fine camere =1


    File invia.php

    $casella = isset($_POST['prenota']) ? 'selezionata' : 'non selezionata';
    if (strcmp($casella,"selezionata")==0) { $tot = $_SESSION ["tot"];
    echo "Il costo della camera &egrave: <b> ".$tot."</b>, il costo spiaggia &egrave <b>".$costospiaggia."</b> ed il costo culla &egrave <b>".$costoculla;
    $costototale = $tot + $costospiaggia + $costoculla;
    echo "</b><br><br>"."<b>TOTALE</b>: <font color='blue' size='5'>".$costototale."</font>. Per prenotarsi riempire il modulo e cliccare su <b>Invia</b>";
    }

    Il mio problema è che quando vado a richiamare la radio button, mi viene visualizzato sempre come costo camera il risultato della seconda radio (quadrupla standard) e non quella che seleziono io.
    Come faccio a richiamare correttamente quella che seleziono io?

    Daniele

  2. #2
    Risolto ragazzi.

    Grazie lo stesso

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.