Use php to write your own blog program on sinaappengine. When creating or updating an article, you can use textarea to store the article content. Currently, the article content is saved to the database in plain text format. The form is like this (in write_article.php): {code...} saves the article's SQL... write your blog program in php on sina app engine. When creating or updating an article, you can use textarea to store the article content. Currently, the article content is saved to the database in plain text format.
The form is as follows (in write_article.php ):
The SQL statement for saving the article is as follows (in save_article.php ).
$content = $_POST["article_text"];// update article$sql = "update article set title=\"$title\",type=\"$category\",content=\"$content\",summary=\"$summary\",updatetime=\"$datetime\" where id=$id";... ...// save new article$sql = "insert into article values ($id, \"$category\", \"$title\", \"$author\", \"$summary\", \"$content\", \"$datetime\", \"$datetime\", $hits)";
However, when updating an article (in write_article.php), it is found that there are always six more spaces at the beginning of the text displayed in textarea. Delete spaces and submit the article. When the article is edited, it is found that there are still six more spaces at the beginning of textarea.
HoweverRead articlesNo extra spaces are found at the beginning of the article.
I cannot explain it, so I ask for help. What is the extra space?
Reply content:
Use php to write your own blog program on the sina app engine. When creating or updating an article, you can use textarea to store the article content. Currently, the article content is saved to the database in plain text format.
The form is as follows (in write_article.php ):
The SQL statement for saving the article is as follows (in save_article.php ).
$content = $_POST["article_text"];// update article$sql = "update article set title=\"$title\",type=\"$category\",content=\"$content\",summary=\"$summary\",updatetime=\"$datetime\" where id=$id";... ...// save new article$sql = "insert into article values ($id, \"$category\", \"$title\", \"$author\", \"$summary\", \"$content\", \"$datetime\", \"$datetime\", $hits)";
However, when updating an article (in write_article.php), it is found that there are always six more spaces at the beginning of the text displayed in textarea. Delete spaces and submit the article. When the article is edited, it is found that there are still six more spaces at the beginning of textarea.
HoweverRead articlesNo extra spaces are found at the beginning of the article.
I cannot explain it, so I ask for help. What is the extra space?
You</Code> there will be blank spaces and line breaks, so this will happen. The content is written with <code> <textarea> </code>, </p> <p> when saving, use <code> $ content = trim ($ _ POST ["article_text"]); </code> </p> <p> ~ </P> <p class = "answer fmt" data-id = "1020000000332993"> <p> changed: </p> <pre> <code> <textarea rows = "20" cols = "80" name = "article_text"> <? Php if ($ op = "update") {echo $ content ;}?>
Note that textarea does not contain anything redundant. Your original code contains line breaks and spaces.