Buongiorno ho il seguente problema il seguente codice non mi passa i dati fra le pagine e non restituisce nessun errore... in pratica nella form di modifica dei dati non ho i valori.
Grazie
codice HTML:
<?php
global $id_aff; global $affitti; global $img; global $img_small; global $descrizione; global $zona; global $cod_aff; global $rif; error_reporting(E_ALL); //Connessione include 'conn.php'; //Leggo i dati dal DB $dati=mysql_query("select id_aff, affitti, rif, descrizione, zona, img_small from AFFITTI order by affitti") or die(mysql_error()); //Controllo che siano caricati i dati if (mysql_num_rows($dati)>0) { while ($rs=mysql_fetch_array($dati, MYSQL_BOTH)) { echo "<img src='../admin/images/".$rs["img_small"]."' border='0' align='absmiddle'> - ".$rs["affitti"]."<br><a href=classi.php?id_aff=".$rs["id_aff"]."> </a> <br> <a href='aff_modifica.php?id_aff=".$rs["id_aff"]."'>Modifica questa news</a><br><br> <a href='aff_elimina.php?id_aff=".$rs["id_aff"]."'>Elimina questa news</a><br><br>" ; } } echo "<br><br><a href='aff_modifica.php?id_aff=0'>Inserisci una news</A><br>" ?>
codice HTML:
<?php //Connessione
include 'conn.php'; $conn=mysql_connect($host,$user,$pwd); mysql_select_db($db,$conn);
//scrivo il nome della affitti
if ($id_aff!=0) { $daticat=mysql_query("select affitti from AFFITTI where id_aff=$id_aff"); while ($rscat=mysql_fetch_array($daticat, MYSQL_BOTH)) { echo "<b>".$rscat["affitti"]."</b><br><br>"; } $target="aff_chg.php"; $dati=mysql_query("select affitti, img, descrizione, zona, rif, img_small from AFFITTI where id_aff=$id_aff");
//Controllo che siano caricati i dati
if (mysql_num_rows($dati)>0) { while ($rs=mysql_fetch_array($dati, MYSQL_BOTH)) {
//leggo i dati e li memorizzo
$affitti=$rs["affitti"]; $descrizione=$rs["descrizione"]; $zona=$rs["zona"]; $img=$rs["img"]; $img_small=$rs["img_small"]; $rif=$rs["rif"]; } echo $affitti; } else echo "Errore - Non esiste questa news<br><br>"; } else { $target="aff_add.php"; echo "<b>Inserimento di una nuova Vendita</b>"; } echo "<form action='$target' method='post' enctype='multipart/form-data'>"; ?> <?php echo $affitti ?> <table width="100%" cellspacing="1" cellpadding="3"> <tr> <td width="13%" valign="top"> </td> <td width="7%" valign="top"><strong>Titolo:</strong></td> <td width="80%"><?php echo "<input type='text' name='affitti' value='$affitti'>"; ?> </td> </tr> <td><?php echo $affitti ?> </td> <tr> <td valign="top"> </td> <td valign="top"><strong>File:</strong></td> <td> <?php if ($img_small!="") echo "<img src='../admin/images/$img_small'>"; ?> <br> <input type="file" name="img_small"> <br> <input name="el_img_small" type="checkbox" value="1"> Sostituisci l'immagine<br> </td> </tr> <tr> <td valign="top"> </td> <td valign="top">Corpo:</td> <td><textarea name="descrizione" id="descrizione" cols="45" rows="5"> </textarea></td> </tr> <tr> <td colspan="3" align="left" valign="top"> <div align="center"><br> <input type="submit" name="Submit" value=" Invia "></form> </div></td> </table>
<?php echo "</form>"; ?>