Home > Backend Development > PHP Problem > What should I do if php cannot transmit the form?

What should I do if php cannot transmit the form?

藏色散人
Release: 2023-02-28 11:56:02
Original
2304 people have browsed it

What should I do if php cannot transmit the form?

#What should I do if php cannot transmit the form value?

Error code;

html页代码:
<form action="show.php" target="mainFrame" method="post">
<input type="text" name="words" cols="200"/><input type="submit" value="发言"/>
php页代码:
<?php require_once(&#39;config.php&#39;); ?><?phpmysql_select_db("data");$words=$_post[&#39;words&#39;];if($words){$query="insert into chat(chtime,nick,words,face)values(now(),&#39;$nick&#39;,&#39;$words&#39;,&#39;$face&#39;)";//插入SQL语句mysql_query($query,$link_ID); //发送留言到数据库header("refresh:0; URL=&#39;show.php&#39;"); }
?>
Copy after login

Solution:

php is case-sensitive, use $_POST to check.

Another one, in the html part, the end character of the form cannot be seen.

<form method="post" action="show.php" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<input type="text" name="words" value="" />
<input type="submit" value="发言"/>
</form>
<?php
mysql_select_db("data");
$words = $_POST["words"];
if($words){
$query="insert into chat(chtime,nick,words,face)values(now(),&#39;$nick&#39;,&#39;$words&#39;,&#39;$face&#39;)";//插入SQL语句
mysql_query($query,$link_ID); //发送留言到数据库
header("refresh:0; URL=&#39;show.php&#39;"); }
?>
Copy after login

Follow the above steps to improve it. If it still doesn’t work, add a print_r($_POST); in front of mysql_select_db("data"); to see what data can be output.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of What should I do if php cannot transmit the form?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template