As from the heading you can see that I have a Update problem with my form. The problem is it does not update, it doesn't give me any errors when script executes it says everything has been updated successfully however that is not the case. My add to DB script is working fine but this one is not I dont know why. If someone knows please help.
PHP Code:<?php
include '../data/data.php';
include 'index.php';
//GET ID FROM THE URL - MAKE SURE WE GET AN INTEGER VALUE
$nid=intval($_GET['id']);
?>
<html>
<head>
<title>Edit</title>
<style type="text/css">
<!--
#table {
border: 1px solid #666666;
width:785px;
border-collapse: collapse;
}
label
{
width: 4em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block
}
.submit input
{
margin-left: 4.5em;
}
input, textarea
{
color: #781351;
background: #fee3ad;
border: 1px solid #781351
}
.submit input
{
color: #000;
background: #ffa20f;
border: 2px outset #d7b9c9
}
fieldset
{
border: 1px solid #781351;
width: 20em
}
legend
{
color: #fff;
background: #ffa20c;
border: 1px solid #781351;
padding: 2px 6px
}
-->
</style>
<style type="text/css">
textarea{
width:250px;
height:100px
width:144px;
height:80px;
overflow:auto;
}
</style>
</head>
<body><br /><br />
<center>
<div>
<?php
if ($nid>0) {
$query=mysql_query("SELECT * FROM `nek` WHERE `nid`='".$nid."' LIMIT 1");
while ($fetch=mysql_fetch_assoc($query)) {
print '<form enctype="multipart/form-data" action="edit.php" method="POST">';
print '<table width="628" border="0" cellpadding="0" cellspacing="0" id="table">';
print " <tr>";
print ' <td width="113">Address:</td>';
print ' <td><textarea id="textarea" type="text" name = "address" />'.$fetch['address'].'';
print ' </textarea></td>';
print ' <td width="133"> </td>';
print ' <td width="219"> </td>';
print " </tr>";
print " <tr>";
print ' <td>Area:</td>';
print ' <td><input type="text" name = "size" value="'.$fetch['size'].'"></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td>Price:</td>";
print ' <td><input type="text" name = "price" value="'.$fetch['price'].'" /></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td>Date:</td>";
print ' <td><input type="text" name = "date" value="'.$fetch['date'].'" /></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td>City:</td>";
print ' <td><input type="text" name = "city" value="'.$fetch['city'].'" /></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print ' <td width="160">Type:</td>';
print ' <td><input type="text" name = "type" value="'.$fetch['type'].'" /></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print ' <tr valign="top">';
print " <td>Details:</td>";
print ' <td><textarea id="textarea" type="text" name = "description" />'.$fetch['description'].'';
print ' </textarea></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td> </td>";
print " <td> </td>";
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td>Main Photo:</td>";
print ' <td><input type="file" name="photo0" value="'.$fetch['photo0'].'"></td>';
print " <td> </td>";
print " <td> </td>";
print " </tr>";
print " <tr>";
print " <td>Photo 1:</td>";
print ' <td><input type="file" name="photo1" value="'.$fetch['photo1'].'"></td>';
print " <td>Photo 4:</td>";
print ' <td width="160"><input type="file" name="photo4" value="'.$fetch['photo4'].'"></td>';
print " </tr>";
print " <tr>";
print " <td>Photo 2:</td>";
print ' <td><input type="file" name="photo2" value="'.$fetch['photo2'].'"></td>';
print " <td>Photo 5:</td>";
print ' <td><input type="file" name="photo5" value="'.$fetch['photo5'].'"></td>';
print " </tr>";
print " <tr>";
print " <td>Photo 3:</td>";
print ' <td><input type="file" name="photo3" value="'.$fetch['photo3'].'"></td>';
print " <td>Photo 6:</td>";
print ' <td><input type="file" name="photo6" value="'.$fetch['photo6'].'"></td>';
print "</tr>";
print "</table><br />";
print '<input type="submit" value="Add">';
print "</form>";
}
} else {
print '<tr><td colspan="4">Error: wrong ID number.</td></tr>';
}
?>
</div>
</center>
</body>
</html>Thank you for taking interest.PHP Code:<?php
include '../data/data.php';
//GET ID FROM THE URL - MAKE SURE WE GET AN INTEGER VALUE
$nid=intval($_GET['id']);
?>
<html>
<head>
<title>Edit</title>
</head>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="screen">
<body>
<div align="center">
<table cellspacing="0" cellpadding="0" width="599">
<tr>
<td id="topone"><br /><br />
</td>
</tr>
<tr>
<td id="contentone">
<div id="text">
<table border="1" cellspacing="0" cellpadding="0" width="590">
<?php
$query=mysql_query("UPDATE `nek` SET address = '$address', size = '$size', price = '$price', date = '$date', city = '$city', type = '$type', description = '$description', photo0 = '$photo0', photo1 = '$photo1', photo2 = '$photo2', photo3 = '$photo3', photo4 = '$photo4', photo5 = '$photo5', photo6 = '$photo6' WHERE `nid`='".$nid."' LIMIT 1");
print '<tr><td colspan="4">Successfully Deited</td></tr>';
?>
</table>
</div>
</td>
</tr>
<tr>
<td height="27" id="bottomone">
</td>
</tr>
</table>
</div><br /><br /><br />
<center><a href="admin.php">Back</a></center>
</body>
</html>![]()




Reply With Quote