I have a major problem with the script below. The chosen data to be edited would be taken from the MySQL database and placed in the text boxes. I would like to be able to change this data and then select "make changes". However, all the data in that table is replaced with copies of the data that has just been changes.
This has really frustrated me, any help would be greatly appreciated.
Mark
<?php
if(isset($_GET['exe'])) {
mysql_connect("??????", "??????", "???????");
mysql_select_db('property');
$typ = $_GET['type'];
$add = $_GET['address'];
$are = $_GET['area'];
$bed = $_GET['bedrooms'];
$bat = $_GET['bathrooms'];
$ren = $_GET['rent'];
$new = $_GET['new_rent'];
$des = $_GET['description'];
//$ima = $_GET['image'];
$map = $_GET['map'];
print "$typ";
print "$add";
print "$are";
print "$bed";
print "$bat";
print "$ren";
print "$new";
print "$des";
//print "$ima";
print "$map";
print "property successfully changed";
$result = mysql_query(
"update property set type = '$typ', address= '$add', area= '$are', bedrooms = '$bed', bathrooms = '$bat', rent = '$ren', new_rent= '$new', description= '$des', map= '$map'");
} else {
$row = $_GET['id'];
//print_r($row);
$detail = explode(',',$row);
//print_r($detail);//prints out array
?>
</p>
<form name="form1" method="get"
action="change.php">
<p><br>
Type:
<input type="text" name="type" value="<? echo $detail[1]; ?>">
</p>
<p><br>
Address:
<input type="text" name="address" value="<? echo $detail[2]; ?>">
</p>
<p><br>
Area:
<input type="text" name="area" value="<? echo $detail[3]; ?>">
</p>
<p><br>
Bedrooms:
<input type="text" name="bedrooms" value="<? echo $detail[4]; ?>">
</p>
<p><br>
Bathrooms:
<input type="text" name="bathrooms" value="<? echo $detail[5]; ?>">
<br>
<br>
Rent:
<input type="text" name="rent" value="<? echo $detail[6]; ?>">
<br>
<br>
New Rent:
<input type="text" name="new_rent" value="<? echo $detail[7]; ?>">
0-100, 101-150, 151-200, 201-250, 251-300 etc<br>
</p>
<p>Description:
<input type="text" name="description" value="<? echo $detail[8]; ?>">
</p>
<p> </p>
<p>Map:
<input type="text" name="map" value="<? echo $detail[9]; ?>">
</p>
<p><br>
<input type="submit" name="exe"
value="Make Changes">
</p>
</form>
<? } ?>
This has really frustrated me, any help would be greatly appreciated.
Mark
<?php
if(isset($_GET['exe'])) {
mysql_connect("??????", "??????", "???????");
mysql_select_db('property');
$typ = $_GET['type'];
$add = $_GET['address'];
$are = $_GET['area'];
$bed = $_GET['bedrooms'];
$bat = $_GET['bathrooms'];
$ren = $_GET['rent'];
$new = $_GET['new_rent'];
$des = $_GET['description'];
//$ima = $_GET['image'];
$map = $_GET['map'];
print "$typ";
print "$add";
print "$are";
print "$bed";
print "$bat";
print "$ren";
print "$new";
print "$des";
//print "$ima";
print "$map";
print "property successfully changed";
$result = mysql_query(
"update property set type = '$typ', address= '$add', area= '$are', bedrooms = '$bed', bathrooms = '$bat', rent = '$ren', new_rent= '$new', description= '$des', map= '$map'");
} else {
$row = $_GET['id'];
//print_r($row);
$detail = explode(',',$row);
//print_r($detail);//prints out array
?>
</p>
<form name="form1" method="get"
action="change.php">
<p><br>
Type:
<input type="text" name="type" value="<? echo $detail[1]; ?>">
</p>
<p><br>
Address:
<input type="text" name="address" value="<? echo $detail[2]; ?>">
</p>
<p><br>
Area:
<input type="text" name="area" value="<? echo $detail[3]; ?>">
</p>
<p><br>
Bedrooms:
<input type="text" name="bedrooms" value="<? echo $detail[4]; ?>">
</p>
<p><br>
Bathrooms:
<input type="text" name="bathrooms" value="<? echo $detail[5]; ?>">
<br>
<br>
Rent:
<input type="text" name="rent" value="<? echo $detail[6]; ?>">
<br>
<br>
New Rent:
<input type="text" name="new_rent" value="<? echo $detail[7]; ?>">
0-100, 101-150, 151-200, 201-250, 251-300 etc<br>
</p>
<p>Description:
<input type="text" name="description" value="<? echo $detail[8]; ?>">
</p>
<p> </p>
<p>Map:
<input type="text" name="map" value="<? echo $detail[9]; ?>">
</p>
<p><br>
<input type="submit" name="exe"
value="Make Changes">
</p>
</form>
<? } ?>