ragazzi ho fatto questo script diciamo che sto impazzando a capire perchè non funziona, allora, io getto i dati attraverso un link ad un altra pagina infatti me li mostra correttamete quando vado a modificarli e poi preso su invia i dati non vengono modificati
lo script è questo qua:
Codice PHP:
<?php
include('./config.php');
if(isset($_POST['check'])) {
$id = $_POST['id'];
$titolo =$_POST['titolo'];
$titolo_inglese =$_POST['titolo_inglese'];
$titolo_francese =$_POST['titolo_francese'];
$titolo_tedesco =$_POST['titolo_tedesco'];
$descrizione=$_POST['descrizione'];
$descrizione_inglese=$_POST['descrizione_inglese'];
$descrizione_tedesco=$_POST['descrizione_tedesco'];
$descrizione_francese=$_POST['descrizione_francese'];
$uploaddir = "./image/";
$uploadfile = $uploaddir.basename($_FILES['UploadedFile']['name']);
if (move_uploaded_file($_FILES['UploadedFile']['tmp_name'], $uploadfile)) {
$img = $_FILES['UploadedFile']['name'];
$in_sql = "UPDATE prodotti SET titolo='$titolo, img='$img', descrizione='$descrizione', titolo_inglese= '$titolo_inglese', titolo_francese ='$titolo_francese', titolo_tedesco='$titolo_tedesco', descrizione_inglese='$descrizione_inglese', descrizione_francese='$descrizione_francese', descrizione_tedesco='$descrizione_tedesco' WHERE id = '" . $_POST['id'] . "'";
$result = @mysql_query($in_sql);
echo "[b]prodotto modifica con successo.[/b]";
if(!$result) die("Errore MySQL: ".mysql_error().'"
Query:
"'.$in_query);
}
}
?>
<?php
$a_sql ="SELECT * FROM prodotti WHERE id = '" . $_GET['id'] ."'";
$a_query = @mysql_query($a_sql);
$a_result = @mysql_fetch_array($a_query);
?>
<form enctype="multipart/form-data" name="form1" method="post" action="./content.php?page=7">
<table width="77%" border="0" align="center">
<tr>
<td>Titolo in italiano</td>
<td>titolo in tedesco</td>
</tr>
<tr>
<td><input type="text" name="titolo" size="25" value="<?=$a_result['titolo'];?>"></td>
<td><input type="text" name="titolo_tedesco" size="25" value="<?=$a_result['titolo_tedesco'];?>"></td>
</tr>
<tr>
<td>titolo in inglese</td>
<td>titolo in francese </td>
</tr>
<tr>
<td><input type="text" name="titolo_inglese" size="25" value="<?=$a_result['titolo_inglese'];?>"> </td>
<td><input type="text" name="titolo_francese" size="25" value="<?=$a_result['titolo_francese'];?>"></td>
</tr>
<tr>
<td>Immagine Prodotto</td>
<td></td>
</tr>
<tr>
<td><INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1024000"><input class="textbox" name="UploadedFile" type="file" size="20" ></td>
<td></td>
</tr>
<tr>
<td><textarea cols="25" rows="5" name="descrizione"><?=$a_result['descrizione'];?></textarea></td>
<td><textarea cols="25" rows="5" name="descrizione_inglese"><?=$a_result['descrizione_inglese'];?></textarea></td>
</tr>
<tr>
<td><div>Descrizione Tedesco:</div></td>
<td><div>Descrizione Francese:</div></td>
</tr>
<tr>
<td><textarea cols="25" rows="5" name="descrizione_francese"><?=$a_result['descrizione_francese'];?>
</textarea></td>
<td><textarea cols="25" rows="5" name="descrizione_tedesco"><?=$a_result['descrizione_tedesco'];?>
</textarea></td>
</tr>
<tr>
<td><input value="<?=$a_result['id'];?>" name="id" type="hidden" />
<input value="check" name="check" type="hidden" />
<input type="submit" name="enter" id="enter" value="Submit" /></td>
<td></td>
</tr>
</table>
</form>