php $ _GET/$ _ POST [英] php $_GET/$_POST
问题描述
你好!
我的PHP有点问题-$ _GET/$ _ POST
首先,我有一个按钮:
Hello!
I have a little problem with PHP- $_GET/$_POST
First I have a button:
<form action=''index.php'' method=''post''>
<input type=''submit'' name=''show'' value=''Make a post!''>
</form>
然后在php中:
And then in php:
if ($_POST[''show''])
{
//echoing out another button with the name, submit
echo "<form action=''index.php'' method=''POST''>
<input type=''submit'' style=''width: 175px;'' name=''submit'' value=''post''>
</form>"; //and some text boxes!
然后...这会将我在某些文本框中(在这里没有写过)写的东西上传到mysql:
And then... This will upload the things that i wrote in some text boxes(which I didn''t write here) to mysql:
if ($_POST[''submit''])
{
$name = $_POST[''name''];
$email = $_POST[''email''];
$message = $_POST[''message''];
$date = date("Y-m-d");
$time = date("H:i:S");
if ($name&&$email&&$message)
{
$querypost = mysql_query("INSERT INTO blog VALUES ('''',''$name'',''$email'',''$message'',''$date'',''$time'')");
echo "Please wait... <meta http-equiv=''refresh'' content=''2''>";
}
else
echo ''Please fill out all fields'';
}
但它不起作用,我找不到原因?!当我没有"if($(_ POST ["显示])"时,上载(以及其他所有内容)都可以正常工作.
谢谢!
But its not working, and i can''t find a reason to why?! The uploading (and everything else) is working when i don''t have the "if ($_POST[''show''])" .
Thank you!
推荐答案
_GET/
_POST
首先,我有一个按钮:
_POST
First I have a button:
<form action=''index.php'' method=''post''>
<input type=''submit'' name=''show'' value=''Make a post!''>
</form>
然后在php:
And then in php:
if (
_POST[''show'']) { //echoing out another button with the name, submit echo "<form action=''index.php'' method=''POST''> <input type=''submit'' style=''width: 175px;'' name=''submit'' value=''post''> </form>"; //and some text boxes!
_POST[''show'']) { //echoing out another button with the name, submit echo "<form action=''index.php'' method=''POST''> <input type=''submit'' style=''width: 175px;'' name=''submit'' value=''post''> </form>"; //and some text boxes!
然后...这会将我在某些文本框中(在这里没有写过)写的东西上传到mysql:
And then... This will upload the things that i wrote in some text boxes(which I didn''t write here) to mysql:
if (
这篇关于php $ _GET/$ _ POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!