文章编辑不起作用的PHP [英] Article edit not working php
本文介绍了文章编辑不起作用的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在文章编辑方面遇到了很大的问题.我需要选择文章并将其放置到表单(标题和文本区域)中.但是我什至无法打开它.你能帮我吗?谢谢.
i have quite problem with article editing. I need to select article and place it to form(title and textarea) yet. But i cant even open it. Can u help me please ? Thanks.
<?php
session_start();
include_once('../includes/conn.php');
include_once('../includes/article.php');
$article= new Article;
if(isset($_SESSION['logged_in'])){
$articles=$article->fetch_all();
if(isset($_POST['id'])){
$id=$_POST['id'];
$query=$pdo->prepare('SELECT * FROM articles WHERE article_id=?');
$query->bindValue(1,$id);
$query->execute();
}
?>
<html>
<form action="" method="post" autocomplete="off">
<input type="text" name="title" value="<?php echo
$article['article_title'];?>"/><br/><br/>
<textarea rows="15" cols="50" value="<?php echo
$article['article_content'];?>" name="content"></textarea><br/><br/>
<input type="submit" value="Add article"/>
</html>
<?php
} else {
header('Location: index.php');
}
?>
推荐答案
textarea没有value属性,您必须将其值放置在textarea的开始和结束标记之间
There is no value attribute for textarea you have to place your value between start and end tag of textarea
<?php
session_start();
include_once('../includes/conn.php');
include_once('../includes/article.php');
$article= new Article;
if(isset($_SESSION['logged_in'])){
$articles=$article->fetch_all();
if(isset($_POST['id'])){
$id=$_POST['id'];
$query=$pdo->prepare('SELECT * FROM articles WHERE article_id=?');
$query->bindValue(1,$id);
$query->execute();
}
?>
<html>
<form action="" method="post" autocomplete="off">
<input type="text" name="title" value="<?php echo
$article['article_title'];?>"/><br/><br/>
<textarea rows="15" cols="50" name="content"><?php echo
$article['article_content'];?></textarea><br/><br/>
<input type="submit" value="Add article"/>
</html>
<?php
} else {
header('Location: index.php');
}
?>
这篇关于文章编辑不起作用的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文