I want to resize and upload a photo with a description of it in a database. This is my script, but also the filename nothing happens. Please help
<?php
if(isSet($_POST['submit'])) {
if(isSet($_POST['date'], $_POST['description'], $_POST['text'], $_POST['author'], $_POST['title'])) {
$date = $_POST['date'];
$description = $_POST['description'];
$text = $_POST['text'];
$author = $_POST['author'];
$title = $_POST['title'];
} else {
$date = '';
$description = '';
$text = '';
$author = '';
$title = '';
}
if(!$date || !$description || !$text || !$author || !$title)
{
$title = $_FILES['title']['name'];
$titleTmp = $_FILES['title']['tmp_name'];
$titleSize = $_FILES['title']['size'];
$time = time();
$newname = "$time$format";
$size = getimagesize( $_FILES['title']['tmp_name'] );
$width = $size[0];
$height = $size[1];
$new_width = 100;
$new_height = 100;
if ( $width > $height ) $new_height = $new_width / ( $width / $height );
else if ( $height > $width ) $new_width = $new_height * ( $width / $height );
$thumb = imagecreatetruecolor( $new_width, $new_height );
mysql_query ("INSERT INTO lessons (title,date,description,text,author) VALUES ('{$title}', '{$date}','{$description}','{$text}','{$author}')") or die(mysql_error());
echo '<p>Успешно добавено!</p>';
}
} else {
echo '
<form method=\'post\' enctype=\'multipart/form-data\' action=\'\'>
<p>
<label>ADD IMAGE<br /><input name=\'title\' type=\'file\'><br /></label>
</p>
<p>
<label>CAR BRAND<br><input name=\'date\' type=\'text\' id=\'date\' value=\'2007-01-27\'></label>
</p>
<p>
<label>DESCRIPTION OF CARS<textarea name=\'description\' id=\'description\' cols=\'40\' rows=\'5\'></textarea></label>
</p>
<p>
<label>LOW PRICE<br /><textarea name=\'text\' id=\'text\' cols=\'40\' rows=\'5\'></textarea></label>
</p>
<p>
<label>HIGH PRICE<br><input type=\'text\' name=\'author\' id=\'author\'></label>
</p>
<p>
<label><input type=\'submit\' name=\'submit\' id=\'submit\' value=\'Record in the database\'></label>
</p>
</form>';
}
?>

