Hi!,
I am getting a warning message while trying to update values in textfield but the values are getting updated in database. here is my code,
<?php
$id = $_GET['id'];
//print_r($id);
$action = $_GET['action'];
$page_name = mysql_real_escape_string($_POST['page_name']);
$page_content = mysql_real_escape_string($_POST['page_content']);
if (isset($action) && $action=='edit')
{
$sql = "SELECT * FROM posts WHERE post_id=".$id;
//print_r($sql);
$result = mysqli_query($con, $sql);
}
if (isset($_POST['submit'])) {
$sql = "UPDATE posts SET post_name = '".$page_name."', post_content = '".$page_content."' WHERE post_id=".$id;
//print_r($sql);
$result = mysqli_query($con, $sql);
}
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
?> <form action="edit-page.php?id=<?php echo $id; ?>" method="POST"> <legend>Edit page</legend> <input type="text" name="page_name" placeholder="page name" class="page-name-field" value="<?php if(isset($row["post_name"])) echo $row["post_name"]; ?>" required/> <textarea name="page_content" placeholder="place content here" class="page-content-field"><?php if(isset($row["post_content"])) echo $row["post_content"]; ?>