Risolto
value="Y"<?php if ($prova=="Y") {echo "CHECKED";} ?>>
value="Y"<?php if ($prova=="N") {echo "CHECKED";} ?>>
Cmq se avevte altre idee ben accette
Risolto
value="Y"<?php if ($prova=="Y") {echo "CHECKED";} ?>>
value="Y"<?php if ($prova=="N") {echo "CHECKED";} ?>>
Cmq se avevte altre idee ben accette
come faccio a passare il valore di un radiobutton ad una pagina di conferma?
Avevo fatto così
Pagina Inserimento
<?php
session_start();
$_SESSION['prova'] = $_POST['prova'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<p> </p>
<form id="form1" name="form1" method="post" action="Senza titolo-3.php">
<p>
<label>
<input type="radio" name="prova" value="Y" />
Pulsante di scelta</label>
A<br />
<label>
<input type="radio" name="prova" checked="checked" value="N" />
Pulsante di scelta</label>
B<br />
<label>
<input type="submit" name="Submit" value="Invia" />
</label>
</p>
</form>
<p> </p>
</body>
</html>
Pagina visualizzazione
<?php
session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="prova" value="<?php echo $_SESSION['prova']; ?>" />
Pulsante di scelta</label>
A<br />
<label>
<input type="radio" name="prova" value="<?php echo $_SESSION['prova']; ?>" />
Pulsante di scelta</label>
B<br />
</p>
</form>
</body>
</html>
Ma non passa niente
prima di tutto grazie x la risposta e l'interessamento.
Ho creato una pagina di ricerca in html con i due campi data_arrivo e data_partenza e un pulsante cerca.Inserisco le due date e Cliccando su cerca mi punta ad un'altra pagina dove mi fa la visualizzazione dei risultati.
Ho aggiunto quello che mi hai detto nella select della pagina dei risultati ma non va,non mi da nessun errore ma non mi visualizza nessuna nessun risultato che invece ci dovrebbe essere
$query_Recordset1 = "SELECT DISTINCT numero_camera FROM stato_pren WHERE stato_pren.data_arrivo<='$data_partenza' AND stato_pren.data_partenza>='$data_arrivo' AND FROM_UNIXTIME(data_arrivo and data_partenza , '%d-%m-%Y')";
ciao
ciao a tutti e rieccomi
Ho una tabella (5 campi) Id,nome,cognome,data_arrivo,data_partenza.
Ho creato una pagina di ricerca dove ho due campi data_arrivo e data_partenza dove qui inserisco le due date,premo invio e mi punta ad un'altra pagina che ho chiamato risultati dove mi visualizza tutti gli id verificati nella data che ho inserito.
I campi del database sono di tipo timestamp e nei campi di ricerca li devo inserire come timestamp altimenti non mi trova niente se li inserisco come (d-m-Y).c'e' un modo di inserire la data nei campi di ricerca (d-m-Y) ed ottenere una risposta valida?
ciao e grazie
risolto,
Il codice che ho postato va bene, ho solo aggiunto il controllo all'inizio
ciao e grazie
<?php require_once('Connections/camere.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO stato_pren (numero_camere, cognome, nome, indirizzo, telefono, fax, email, data_prenotazione, data_arrivo, data_partenza, stato) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['numero_camere'], "text"),
GetSQLValueString($_POST['cognome'], "text"),
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['indirizzo'], "text"),
GetSQLValueString($_POST['telefono'], "text"),
GetSQLValueString($_POST['fax'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['data_prenotazione'], "date"),
GetSQLValueString($_POST['data_arrivo'], "date"),
GetSQLValueString($_POST['data_partenza'], "date"),
GetSQLValueString($_POST['stato'], "text"));
mysql_select_db($database_camere, $camere);
$Result1 = mysql_query($insertSQL, $camere) or die(mysql_error());
$insertGoTo = "cercastatopren.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_camere, $camere);
$query_Recordset1 = "SELECT * FROM stato_pren WHERE stato_pren.data_arrivo<='$data_partenza' AND stato_pren.data_partenza>='$data_arrivo'";
$Recordset1 = mysql_query($query_Recordset1, $camere) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
Vorrei aggiungere un cotrollo di inserimento,se la camera 1 con la data_arrivo e la data_partenza gia esiste mi deve dare camera gia prenotata,ma non riesco a inserire questo controllo.
grazie
ciao