I am trying to update the query and display into the next page. Here is my code,problem is i will get a warning message "Cannot modify header information - headers already sent". Please help.
$id = (isset($_GET['id'])) ? $_GET['id'] : '';
$val = view_data($id);
if (empty($_POST) === false) {
$title = $_POST["offered"];
$description = $_POST["description"];
$id = $_POST["id"];
$update = update($title, $description, $id);
if ($update) {
header("location:hotel2_galery.php");
}
}
HTML
<form action="hotel2_galery_edit.php" method="post" class="col-sm-4">
<div class="form-group has-info">
<input type="hidden" name="id" value="<?php echo $val->offer_id;?>">
<label class="control-label" for="inputSuccess">Offer title
</label>
<input type="text" class="form-control" name="offered" id="offered" value="<?php echo $val->offers_name; ?>">
<label>Offer Description
</label>
<textarea id="description" name="description" class="form-control " rows="3">
<?php echo $val->offers_description; ?>
</textarea>
<br>
<button type="submit" class="btn btn-primary">
<span>UPDATE
</span>
</button>
</div>
</form>