Ciao!![]()
se immetto la data nel form d'immissione dati (es: 12/01/04)ggmmaa
(cioè 12 gennaio 2004 per me secondo lo standard europeo)
il form di visualizzazione mi restituisce la data nel formato aaaammgg
e cioe' 2012-01-04![]()
![]()
Vorrei sapere come faccio a far visualizzare la data ne modo in cui io la immetto? (ggmmaa)![]()
Codice php nel form immisione dati
<?php
if (isset($_POST['nome'])){
include("dati.txt");
$link = mysql_connect($db_host, $db_login, $db_pass) or die (mysql_error());
mysql_select_db($database) or die (mysql_error());
$dati = "INSERT INTO prenotazioni VALUES ('', ";
$dati .= "'" . addslashes($_POST['nome']) . "', ";
$dati .= "'" . addslashes($_POST['cognome']) . "', ";
$dati .= "'" . addslashes($_POST['datarrivo']) . "', ";
$dati .= "'" . $_POST['fax'] . "')";
mysql_query ($dati) or die (mysql_error());
Header("Location: ". $link_to_redirect);
}
?>
Form visualizzazione dati prenotazioni
<?php
include("dati.txt");
$link=mysql_connect("$db_host","$db_login","$db_pa ss")
or die ("Non riesco a connettermi a [b]$db_host");
mysql_select_db ($database, $link)
or die ("Non riesco a selezionare il db $database
");
$tutto = "SELECT * FROM prenotazioni";
$query = mysql_query ($tutto,$link)
or die ("Non riesco ad eseguire la richiesta $tutto");
// Preparo la tabella per accogliere i dati
echo "
<html>
<body>
<TABLE border=\"1\" width=\"100%\">
<tr>
<td width=\"115%\" colspan=\"4\">
<p align=\"center\">Prenotazioni</td>
</tr>
";
while ($valori = mysql_fetch_array ($query)){
$a1 = $valori ["nome"];
$a2 = $valori ["cognome"];
$a3 = $valori ["datarrivo"];
$a4 = $valori ["fax"];
echo "
<tr>
<td width=\"14%\">$a1</td>
<td width=\"14%\">$a2</td>
<td width=\"14%\">$a3</td>
<td width=\"14%\">$a4</td>
</tr>
";
}
echo "</table>";
mysql_close ($link);
?>