logo
Blog single photo

Image Upload Problem


                        

<?php
include("index.php");
include("includes/connection.php");

$edit_record= @$_GET['edit'];

$query="select * from post where post_id='$edit_record'";

$run=mysql_query($query);
while($row=mysql_fetch_array($run)){

$edit_id=$row['post_id'];
$title=$row['post_title'];
$date=$row['post_date'];
$author=$row['post_author'];
$image=$row['post_image'];
$content=$row['post_content'];


?>

<html>
<head><title>post form</title>
</head>
<body>

<form action="edite.php?edit_form = <?php echo $edit_id;?>" method="post" enctype="multipart/form-data">

<table border="3" align="center" width="600">
<tr>
<td align="center" bgcolor="yellow" colspan="9"><h2>Edit From </h2></td>
</tr>
<tr>
<td>post title</td>
<td><input type="text" name="title1" size="40" value="<?php echo $title; ?>"></td>
</tr>

<tr>
<td>post author</td>
<td><input type="text" name="author1" size="40" value="<?php echo $author; ?>"></td>
</tr>
<tr>
<td>post image</td>
<td><input type="file" name="image1"><img src="../images/<?php echo $image;?>" width="60px" height="60px"></td>
</tr>
<tr>
<td>post content</td>
<td><textarea name="content1" rows="20" cols="50" ><?php echo $content; ?>"</textarea></td>
</tr>
<tr>

<td colspan="6" bgcolor="?#‎D3D3D3?"><input type="submit" name="upload" value="Updated Now"</td>
</tr>
<?php }?>
</table>
</form>
</body>
</html>

<?php
if(isset($_POST['update'])){

$update_record=$_GET['edit_form'];

$post_title=$_POST['title1'];
$post_date=date('y-m-d');
$post_author=$_POST['author1'];
$post_content=$_POST['content1'];
$post_image=$_FILES['image1']['name'];
$post_image_type=$_FILES['image1']['type'];
$post_image_size=$_FILES['image1']['size'];
$post_image_tmp=$_FILES['image1']['tmp_name'];
move_uploaded_file($post_image_tmp,"../images/post_image");


$query4="update post set
post_title='$post_title',
post_date='$post_date',
post_author='$post_author',
post_image='$post_image',
post_content='$post_content',
where post_id='$update_record'";

if(mysql_query($query4)){

echo "<script>window.open('edite.php?updated=Data has been Updated successfully','self')</script>";
}
}
?>



<form action="edite.php?edit_form = <?php echo $edit_id;?>" method="post" enctype="multipart/form-data">

try to change here...

only...

<form action="" method="post" enctype="multipart/form-data">

Top