Sooooo....
Why is this not changing the content to my database?
<?php
if(isset($_POST['submit']))
{
if( isset($_POST['post_body']) )
{
$post_body = $_POST['post_body'];
$id = $_POST['id'];
$sql = "UPDATE forum_post SET post_body='$post_body' WHERE post_id='$id'";
$res = mysqli_query($mysql, $sql);
}
if( isset($_POST['post_title']) )
{
$post_title = $_POST['post_title'];
$id = $_POST['id'];
$sql = "UPDATE forum_post SET post_title='$post_title' WHERE post_id='$id'";
$res = mysqli_query($mysql, $sql);
}
}
?>
<form action="<?php $_PHP_SELF ?>" method="POST" class="form-horizontal">
<fieldset>
<legend>Edit</legend>
<div class="form-group">
<input type="hidden" name="id" value="<?php echo $post_id; ?>">
<label for="inputTitle" class="col-lg-2 control-label">Title</label>
<div class="col-lg-5">
<input type="text" class="form-control" id="post_title" name="post_title" placeholder="<?php echo $post_title; ?>" value="<?php echo $post_title; ?>">
</div>
</div>
<div class="form-group">
<label for="inputTitle" class="col-lg-2 control-label">Created</label>
<div class="col-lg-5">
<p><?php echo $post_created;?></p>
</div>
</div>
<div class="form-group">
<label for="textArea" class="col-lg-2 control-label">Textarea</label>
<div class="col-lg-10">
<textarea type="text" name="post_body" id="post_body" rows="8" class="col-md-12" value="<?php echo $post_body; ?>" class="form-control" rows="3">
<?php echo $post_body; ?>
</textarea>
<span class="help-block">Here goes the content.</span>
</div>
<div class="col-md-2"><a href class="col-md-2 btn btn-danger btn-block" ng-show="showme" ng-click="showme=false">Back</a></div>
<input class="pull-right col-md-10 btn btn-primary btn-default" id="submit" type="submit" value="Submit" name="submit"/>
</div>
</fieldset>
</form>
I want this to update my post's content & title for now. Why is this not updating my database? I can't see errors, nothing.
I can fill the form, press update, no error. Console is empty too.
Wheres the problem?