Hi, This is part hotel managment system but we want to create new feature where we can edit room type but this is not my code but it my program because I cant contact programmer so end up need to do my self, so got problem where cant update
Here is only few line of code that I just take from file because it a lot dont worry about connect to DB it in separate file
<?
include('z_header.php');
$general_tab='class="active"';
if ($_REQUEST['edit_types'] == '1') {
$id = mysql_result(mysql_query("SELECT * FROM `ref_types` WHERE `id`=" . $row[id]), 0);
mysql_query("UPDATE `ref_types` SET `code`= '$_REQUEST[code_edit]', `description`='$_REQUEST[description_edit]', `price`='$_REQUEST[price_edit]', `discount`='$_REQUEST[discount_edit]'WHERE `id`='".$id."'");
$types_tab='class="active"';
$general_tab='';
$usermessage = true;
$usermessage_text = 'Room type <b>'.$room_code.'</b> has been Edited successfully!';
}
?>
<table class="listing" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th width="11%" height="21"><?= CODE ?></th>
<th width="19%"><?= HOTEL ?></th>
<th width="23%"><?= DESN ?></th>
<th width="13%"><?= PRICE ?></th>
<th width="13%"><?= DIS ?></th>
<th width="10%"><?= EDIT ?></th>
<th width="11%"><?= DELETE ?></th>
</tr>
<?
$i = 0;
$sql = "SELECT ref_types.*, hotels.hotel_name FROM `ref_types`, hotels WHERE ref_types.hotel_id=hotels.id ";
if (($_REQUEST[hotel_selected] != '-1') && ($_REQUEST[hotel_selected] != '')) {
$sql.='AND ref_types.hotel_id=' . $_REQUEST[hotel_selected];
}
$q = mysql_query($sql);
while ($row = mysql_fetch_assoc($q)) {
?>
<tr<?
if ($i % 2 == 0) {
echo(' class="even"');
}
?>>
<td><?= $row['code'] ?></td>
<td><?= $row['hotel_name'] ?></td>
<td><?= $row['description'] ?></td>
<td><?= $row['price'] ?></td>
<td><?= $row['discount'] ?></td>
<td><a href="#" id="myButton<?= $row['id'] ?>" data-reveal-id="myNewModal" data-animation="fadeAndPop" data-animationspeed="300" data-closeonbackgroundclick="true" data-dismissmodalclass="close-reveal-modal"><img src="img/add2.png"></a></td>
<td><a href="#" onclick="if (confirm('Are you sure to delete `<?= $row['description'] ?>`? This action will affect all the rooms for all hotel as well!')) {location.href='settings.php?delete_type=1&id=<?= $row[id] ?>';} "><img src="img/icons/minus-circle.png"></a></td>
</tr>
<div id="myNewModal<?= $row['id'] ?>" class="reveal-modal">
<?
$sql_supp = "SELECT * FROM `ref_types` WHERE `id`=" . $row[id];
$q_supp = mysql_query($sql_supp);
$row_supp = mysql_fetch_assoc($q_supp);
?>
<h2><?= $row_supp['code'] ?> :<?= $row_supp['description'] ?> </h2>
<hr>
<form action="settings.php" method="post" id="editform<?= $row_supp['id'] ?>" name="editform<?= $row_supp['id'] ?>">
<input type="hidden" value="1" name="general" />
<div class="column grid-16">
<p>
<label><?= CODE ?>:</label><br/>
<input class="text big" value="<?= $row['code'] ?>" type="text" name="code" tabindex="1" />
</p>
</div>
<div class="column grid-5">
<p>
<label><?= DESN ?>:</label><br/>
<input class="text big" value="<?= $row['description'] ?>" type="text" name="description" tabindex="1" />
</p>
</div>
<div class="column grid-5">
<p>
<label><?= PRICE ?>:</label><br/>
<input class="text big" value="<?= $row['price'] ?>" type="text" name="price<?= $row_supp['id'] ?>" id="price<?= $row_supp['id'] ?>" tabindex="2" onchange="AddTotalT()"/>
<input type="hidden" value="0" name="price_hidden<?= $row_supp['id'] ?>" id="price_hidden<?= $row_supp['id'] ?>"/>
</p>
</div>
<div class="column grid-5">
<p>
<label><?= DIS ?>:</label><br/>
<input class="text big" value="<?= $row['discount'] ?>" type="text" name="discount<?= $row_supp['id'] ?>" id="discount<?= $row_supp['id'] ?>" tabindex="3" onkeyup="AddDiscountT()" />
</p>
<input type="submit" class="button small yellow" value="<?= APPLY ?>" />
</p>
</div>
</form>
<hr>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#myButton<?= $row['id'] ?>').click(function(e) {
e.preventDefault();
$('#myNewModal<?= $row['id'] ?>').reveal({
animation: 'fadeAndPop', //fade, fadeAndPop, none
animationspeed: 300, //how fast animtions are
closeonbackgroundclick: true, //if you click background will modal close?
dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
});
e.unlockModal();
});
});
</script>
<?
$i++;
}
?>
</table> `Inline Code Example Here`