<?php
    if(isset($_POST['submit'])){
        $_POST = array_map( 'stripslashes', $_POST );
        extract($_POST);
        if($eventName ==''){
        $error[] = 'Please enter the Event Name.';
    }
        if(!isset($error)){
            try {
                $stmt = $db->prepare('UPDATE event SET eventID = :eventID, eventName = :eventName, eventTime = :eventTime, eventLocation = :eventLocation, postDate = :postDate WHERE eventID = :eventID') ;
                $stmt->execute(array(
                ':eventID' => $eventID,
                    ':eventName' => $eventName,
            ':eventTime' => $eventTime,
            ':eventLocation' => $eventLocation,
            ':postDate' => date('Y-m-d H:i:s')
                ));
                //redirect to index page
                header('Location: view-event.php?action=updated');
                exit;
            } catch(PDOException $e) {
                echo $e->getMessage();
            }
        }
    }
    ?>
And
<?php
        //check for any errors
        if(isset($error)){
            foreach($error as $error){
                echo $error.'<br />';
            }
        }
            try {
                $stmt = $db->prepare('SELECT eventID,eventName, eventTime, eventLocation, postDate FROM event WHERE eventID = :eventID') ;
                $stmt->execute(array(':eventID' => $_GET['eventID']));
                $row = $stmt->fetch(); 
            } catch(PDOException $e) {
                echo $e->getMessage();
            }
        ?>
HTML Form
<form role="form" method="post" action=''>
<input type="hidden" class="form-control" placeholder="Enter Event Name" name="eventID" value='<?php echo $row['eventID'];?>'>
<input class="form-control" placeholder="Enter Event Name" name="eventName" value='<?php echo $row['eventName'];?>'>
<input class="form-control" placeholder="Enter Event Time" name="eventTime" value='<?php echo $row['eventTime'];?>'>
<input class="form-control" placeholder="Enter Event Location" name="eventLocation" value='<?php echo $row['eventLocation'];?>'>
<input type="submit" class="btn btn-primary" name="submit" value="Edit Event">
</form> 
Hi, Here is the code. I want to update data to mysql database. When I hit the button it just loaded to "view-event.php?action=updated" this page but nothing changes in database. Please help me.
 
    