Ciao a tutti, ho un errore con una variabile che invece sembrerebbe essere settata benissimo, eccovi il file:
ed ecco l'errore:
Notice: Undefined variable: category in C:\Program Files\EasyPHP-5.3.2\www\Sito\uploadOpera.php on line 60
Missing data
----
A me sembra tutto ok, è la pagina che viene quando clicco sul bottone per inviare un'immagine, vi metto anche l'altra pagina:
Sapete aiutarmi? Ve ne sarei infinitamente grata
Codice:
<?php
include("connessione.inc");
$title=$_POST["title"];
$tag1=$_POST["tag1"];
$tag2=$_POST["tag2"];
$tag3=$_POST["tag3"];
$category=$_POST["category"];
$description=$_POST["description"];
$who_see=$_POST["who_see"];
$target_path="uploads/";
$date=date("j/M/Y");
$target_path = $target_path.basename( $_FILES['fileUtente']['name']);
function control ($title, $tag1, $tag2, $tag3, $description){
$result=true;
if ($title=="" or $tag1=="" or $tag2=="" or $tag3=="" or $category=="" or $description=="" or $who_see==""){
$result=false;
} return $result;
}
if (control ($title, $tag1, $tag2, $tag3, $description) == true){
if ($_FILES['fileUtente']['error'] == 0) {
move_uploaded_file($_FILES['fileUtente']['tmp_name'], $target_path);
echo "File ".basename( $_FILES['uploadedfile']['name'])." has been uploaded.</br> Now you have to wait that the administrator approve it.";
echo "<a href='upload.php'>Upload another image.</a>";
$sql="INSERT INTO opere(title, tag1, tag2, tag3, category, description, who_see) VALUES('$title','$Tag1', '$Tag2', '$Tag3', '$category', '$description', '$who_see', '$target_path')";
mysql_query($sql,$conn) or die("Errore!".mysql_error());
}
else {
echo "Error in the process, try it again!";
}
}
else { echo "</br>Missing data</br>"; }
?>
Notice: Undefined variable: category in C:\Program Files\EasyPHP-5.3.2\www\Sito\uploadOpera.php on line 60
Missing data
----
A me sembra tutto ok, è la pagina che viene quando clicco sul bottone per inviare un'immagine, vi metto anche l'altra pagina:
Codice:
<?php
include("connessione.inc");
function autorizza(){
if ((isset($_SESSION['login']))&&((isset($_SESSION['password'])))){
echo <<<MESS
<p>You have logged in and you can submit a file.</p></br>
<p><b>Choose Sketch:</b>
<FORM enctype="multipart/form-data" action="uploadOpera.php" id="uploadOpera" method="POST" name="modulo">
<input name="fileUtente" type="file" maxlength="1000"></p>
</br>
<p><b>Title</b></br>
Insert the title:<br>
<input type="text" name="title">
</br></p>
<p><b>Insert tags</b>:</br>
<input name="tag1" type="text" size="20" maxlength="30"></br>
<input name="tag2" type="text" size="20" maxlength="30"></br>
<input name="tag3" type="text" size="20" maxlength="30"></label>
</br>
</p><p>
<b>Category</b></br>
<input type="radio" name="category" value="nature" checked="checked"/>Nature
<input type="radio" name="category" value="people"/>People
<br>
<input type="radio" name="category" value="animal"/>Animal
<input type="radio" name="category" value="other"/>Other
</p>
</br>
<p><b>Description</b></br>Describe your sketch:</br>
<textarea name="description" cols="40" rows="10" maxlength="300" onkeyup="ContaCaratteri()">
</textarea>
<input type="text" name="conta" readonly>
</p>
</br>
</br>
<p><b>Who can see this sketch?</b></br>
<select name="who_see" >
<option value="1" selected="selected">All users</option>
<option value="0">Only friends</option>
</select></p>
</br>
</br>
<button type="submit">
submit
</button>
MESS;
}
else {
echo "<p>We are sorry, you need to login to submit a file!</p>";
}
}
echo autorizza();
?>