I have a sample data in my database that I am trying to override with my data in a form submission with a primary key PageID set to 0, my query to my knowledge is correct, I have no errors upon submission just no data going into the database. Here is the entire PHP document.
<?php
if(isset($_POST['update'])){
$pageid = 0;
$dbc = @mysqli_connect ('localhost', 'elinksw_ju1ez', '*******', 'elinksw_ju1ez') OR die ('<p class="error">Cannot connect to the database.</body></html>');
$q = "UPDATE tblContent SET PageHeading='$_POST[PageHeading]' ,SubHeading='$_POST[SubHeading]' ,Content='$_POST[Content]' ,PageTitle='$_POST[PageTitle]' ,MetaDescription='$_POST[MetaDescription]' ,MetaKeywords='$_POST[MetaKeywords]' WHERE PageID='$pageid'";
$r = mysqli_query($dbc, $q);
mysqli_close($dbc);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./includes/adminStyle.css">
<title>Administration - Edit content</title>
</head>
<body>
<header>
<h1>Edit Content</h1>
<h2>Welcome Administrator</h2>
</header>
<nav>
<a href="admin.php" class="myButton">Manage Homepage</a><br>
<a href="admin.php" class="myButton">Manage Products</a><br>
<a href="admin.php" class="myButton">Manage Contacts</a><br>
</nav>
<section>
<h2>Manage Homepage</h2>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table width="300" cellpadding="2" cellspacing="2">
<tr>
</tr>
<tr>
<td>Page Heading:</td>
<td><input type="text" name="PageHeading"></td> </tr>
<tr>
<td>Sub Heading:</td>
<td><input type="text" name="SubHeading"></td> </tr>
<tr>
<td>Page Title:</td>
<td><input type="text" name="PageTitle"></td> </tr>
<tr>
<td>MetaDescription:</td>
<td><textarea style="width:300px;" cols="55" rows="5" name="MetaDescription"></textarea></td> </tr>
<tr>
<td>MetaKeywords:</td>
<td><input type="text" name="MetaKeywords"></td> </tr>
<tr>
<td>Content:</td>
<td><textarea style="width:300px;" cols="55" rows="5" name="Content"></textarea></td> </tr>
<tr>
<td><input type="submit" name="update" value = "Update Database"></td> </tr>
</section>
</form>
</body>
</html>
Here is the table in the database

$r = mysqli_query($dbc, $q) or die(mysqli_error($dbc));?$_POST['PageHeading']instead of$_POST[PageHeading]. Also, your query is vulnerable to sql injections.$_POSTvalues have single quotes', then your query will fail. At a minimum you want to usemysqli_real_escape_string()and better would be to use prepared statements php.net/manual/en/mysqli.quickstart.prepared-statements.php{}as they would get a syntax error inside double quotes -{$_POST['PageHeading']}