riposto il codice in modo un po piu comprensibile
Codice PHP:
<?php require_once('Connections/Connessione.php');
if (isset($HTTP_SERVER_VARS['QUERY_STRING']
)) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO offerte (Id_asta, Prezzo_offerta, Data_dell_offerta, Orario_offerta, Id_referente_offerta) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['Nome_
asta'], "int"),
GetSQLValueString($HTTP_POST_VARS['Prezz
o_off'], "int"),
GetSQLValueString($HTTP_POST_VARS['Data_
off'], "date"),
GetSQLValueString($HTTP_POST_VARS['Orari
o_off'], "date"),
GetSQLValueString($HTTP_POST_VARS['Id_re
f'], "int"));
mysql_select_db($database_Connessione, $Connessione);
$Result1 = mysql_query($insertSQL, $Connessione) or die(mysql_error());
}
?>
<script language="JavaScript">
<!--
function calcola_tot(Link)
{
newwindow=window.open(Link,"","top=50,left=200,width=550,height=300")
}
//-->
</script>
<html>
<head>
<title>Inserisci offerta</title>
<META http-equiv="REFRESH" content="30">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="aste.css" rel="stylesheet" type="text/css">
</head>
<body onLoad="startclock(); timerONE=window.setTimeout">
</p>
<h3 class="gray">Offerta del Sig.<font color="#FF0000">
<?php VisualCognomeReferente($row_visual_offer
ente['Id_referente']);?>
</font></h3>
<p class="gray"><font color="#FF0000"></font></p>
<form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="75%" border="1" class="tab">
<tr>
<td width="34%">Id referente </td>
<td width="66%"><input name="Id_ref" type="text" class="textbox" id="Id_ref" value="<?php echo $row_visual_offerente['Id_referente'];?>">
</td>
</tr>
<tr>
<td>Titolo dell'asta</td>
<td> <input name="Nome_asta" type="hidden" id="Nome_asta" value="<?php echo $row_visual_asta['Id_asta']; ?>">
<?php VisualNomeAsta ($row_visual_asta['Id_asta']);?>
</td>
</tr>
<tr>
<td>Stile dell'asta</td>
<td><input name="Stile_asta" type="hidden" id="Stile_asta" value="<?php echo $row_visual_asta['Id_stile_asta']; ?>">
<?php VisualNomeStileAsta ($row_visual_asta['Id_stile_asta']);?>
</td>
</tr>
<tr>
<td>Banditore</td>
<td><input name="Id_referente" type="hidden" id="Id_referente" value="<?php echo $row_visual_asta['Id_referente']; ?>">
<?php VisualCognomeReferente ($row_visual_asta['Id_referente']);?>
</td>
</tr>
<tr>
<td height="26">Tipo di asta</td>
<td>
<?php
if ($row_visual_asta['Rialzo'] == 'Yes')
{
echo ("Rialzo");
}
else
{
print ("Ribasso");
}
?>
</td>
</tr>
<tr>
<td height="26">Data e ora di apertura dell'asta</td>
<td>
<?php ConvDate($row_visual_asta['Data_apertura
']); ?>
<?php echo $row_visual_asta['Orario_apertura']; ?></td>
</tr>
<tr>
<td height="26">Data e ora di chiusura</td>
<td>
<?php ConvDate($row_visual_asta['Data_chiusura
']); ?>
<?php echo $row_visual_asta['Orario_chiusura']; ?> </td>
</tr>
<tr>
<td height="26">Prezzo di partenza dell'asta</td>
<td><input name="Prezzo_part" type="text" disabled class="textbox" id="Prezzo_part" value="<?php echo $row_visual_asta['Prezzo_apertura']; ?>">
€ </td>
</tr>
<tr>
<td height="26">Prezzo di riserva</td>
<td><input name="Prezzo_riserva" type="text" disabled class="textbox" id="Prezzo_riserva" value="<?php echo $row_visual_asta['Prezzo_riserva']; ?>">
€ </td>
</tr>
<tr>
<td>Numero delle offerte possibili</td>
<td><input name="Num_off_max" type="text" id="Num_off_max" value="<?php echo $row_visual_asta['Num_off_max']; ?>"></td>
</tr>
<tr>
<td>Numero di possibili offerte rimaste </td>
<td> <table width="100%" border="0">
<?php
if ($row_num_offerte['Id_offerta'] == "")
{
$contatore= -1;
}
else
{
$contatore = 0;
}
do
{
$contatore++;
?>
<tr>
<td> <input type="hidden" name="Id_off" value="<?php echo $row_num_offerte['Id_offerta']; ?>">
</td>
<td><input name="Offerta" type="hidden" id="Offerta" value="<?php echo $contatore; ?>">
</td>
</tr>
<?php } while ($row_num_offerte = mysql_fetch_assoc($num_offerte)); ?>
<?php
$calcola_offerte = $row_visual_asta['Num_off_max'];
//print "$calcola_offerte";
//print "$contatore";
$Offerte_restanti = $calcola_offerte - $contatore;
if ($Offerte_restanti == 0)
{
echo "<input name=\"off_rimanenti\" type=\"text\" class=\"textbox\" disabled id=\"off_rimanenti\" value=\"0\">";
}
else
{
echo "<input name=\"off_rimanenti\" type=\"text\" class=\"textbox\" disabled id=\"off_rimanenti\" value=\"$Offerte_restanti\">";
}
?>
</table></td>
</tr>
<tr>
<td height="26">Prezzo offerta</td>
<td> <input name="prezzo_off" type="text" id="prezzo_off"> </td>
</tr>
<tr>
<td>Data dell'offerta</td>
<td> <input name="Data_off" type="text" class="textbox" id="Data_off" value="<?php
//recupera la data attuale
print (date ("Y-m-d"));
//ConvDate(date("Y-m-d"));
//time("H:m:s")?>"></td>
</tr>
<tr>
<td>Orario dell'offerta</td>
<td><input name="Orario_off" type="text" class="textbox" id="Orario_off" value="<?php
//recupera l'ora attuale
print (date ("H:i:s"));
?>"></td>
</tr>
<tr>
<td>Scarica il documento relativo all'asta</td>
<td>
<?php
$Id_utente = $row_visual_asta['Id_referente'];
$titolo_asta = $row_visual_asta['Id_asta'];
$doc = $row_visual_asta['Documento'];
$tipo= "../stage/Documenti_utenti/$Id_utente/$titolo_asta/$doc";
if ($doc <> "")
{
echo "<A HREF=\"Documenti_utenti/$Id_utente/$titolo_asta/$doc\">Scarica il file</A>
";
}
else
{
print "Nessun file da scaricare";
}
?>
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Inserisci l'offerta">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<?php
if (isset ($insertSQL))
{
print "
<h5><font color=\"#FF0000\" face=\"Verdana\">Inserimento effettuato correttamente</font></h5></p>";
}
?>
</p>
<a href="visualizza_offerte_referente_e_asta.php?Id_referen=<?php echo $row_visual_offerente['Id_referente'];?> & Id_ast=<?php echo $row_visual_asta['Id_asta'];?>">Visualizza
le tue offerte per questa asta</a></p>
<form name="form2" method="POST" action="<?php echo $editFormAction; ?>">
<table width="75%" border="1">
<tr>
<td>Categoria del prodotto</td>
<td></td>
</tr>
<tr>
<td>Nome prodotto</td>
<td>Prezzo</td>
</tr>
<?php
$counter = 0;
do
{
$counter++;
?>
<tr>
<td>
<?php VisualNomeProdotto ($row_visual_prod_asta['Id_prodotto']); ?>
</td>
<td><input name="Prezzo_prod[]" type="text" id="Prezzo_prod<?php echo $counter; ?>">
euro </td>
</tr>
<?php } while ($row_visual_prod_asta = mysql_fetch_assoc($visual_prod_asta)); ?>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit2" value="Invia">
</div></td>
</tr>
<tr>
<td colspan="2"> </tr>
</table>
</form>
</p>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($visual_offerente);
mysql_free_result($visual_asta);
mysql_free_result($visual_offerta);
mysql_free_result($visual_prod_asta);
mysql_free_result($num_offerte);
?>