After spending some time looking at your code, there are some strande construction going on, for a start you're nesting a form in a form, your supposed to seperate forms if you have more than one per page.
<form action="" method="post">
Template name to edit: <input type="text" name="tname"><br><input type="submit">
$tempname = $_POST['tname'];
$con = mysqli_connect('localhost','root','');
$sql = "Select * from cqadmin.keys where templatename = '$tempname'";
$records = mysqli_query($con,$sql);
is later followed on in the script
while($row = mysqli_fetch_array($records))
echo "<tr><form action=update.php method=post>";
echo"<td><input type=hidden name=id value='".$row['id']."'></td>";
echo"<td><input type=hidden name=name value='".$row['templatename']."'></td>";
which is clearly a form
I would look at reworking the page.
You should also go on to the PHP website and read up about mysqli type queries, they are no like mysql function, instead of forming a statement, opening the database, running the query and then fetching the results as needed, you have to make your open your database, create the statement, execute the query, bind the result to variables then you can fetch your results.
Also, when using naming conventions, it is advised that you avoid using a reserved word or a keyword like calling the name of an input <input name="name" can lead to problems, I find my server hates "submit" as the name of the submit button, if I call it Submit, then the server is happy, so finding out about any requirements your host is imposing on you is an important step because your web form may require additional scripting from the hosting server, one host I used insisted that you used a library that they wrote for their servers to ensure that your webform, if using email, your email had to exist on the server if sending a confirmation form.
So in short, if something doesn't work on the server, then theres possibly a config issue, but looking at your script, you have some way to go in regards to outputing a web page and web form that isn't nested or likely to conflict with other forms (through nesting and overlapping of tags)