我从这里重定向
<a href="update_post.php?updid=<?php echo $_SESSION['id']; ?>">Update</a>
和显示错误的代码是
<?php include('../includes/connections.php'); ?>
<?php
try{
if(isset($_POST['submit'])){
$title = $_POST['title'];
$post = $_POST['post'];
$dates = $_POST['date'];
$sql = 'UPDATE `blog`.`contents` SET `titles` = :title, `posts` = :post, `dates` = :date WHERE `contents`.`id` = :idendity';
$result = $pdo->prepare($sql);
$result->bindValue(':title',$title);
$result->bindValue(':post',$post);
$result->bindValue(':date',$dates);
$result->bindValue(':idendity',$_GET['updid']);
$result->execute();
$count = $result->rowCount();
if($count == 1){
header('location: index.php');
}else{
echo 'Problem Occoured';
}
}
}
catch(PDOException $e){
echo "Problem: " .$e->getMessage();
}
?>
显示的错误:-注意:未定义的索引:第 13 行 C:\xampp\htdocs\myblog\admin\update_post.php 中的 updid 发生问题
<form action="update_post.php" method="post">
Title:<br/>
<input style="height:40px;" size="110" type="text" name="title" /><br />
Post:<br />
<textarea rows="30" cols="85" name="post" ></textarea><br />
Date:<br />
<input type="text" name="date" /><br/ >
<input type="submit" name="submit" />
</form>