Home >Backend Development >PHP Tutorial > php传值解决方法

php传值解决方法

WBOY
WBOYOriginal
2016-06-13 13:15:27845browse

php传值
我是php初学者,怎么实现这两个页面的传值???
1.php


 
 
 

 
 
 

 
 
 

 
 
玩家
成绩
 


2.php
$_POST[username]=$username; //获取提交的变量值
$_POST[grade]=$grade;
if($Submit == "提交"){
  echo "玩家" . $_POST[username] . "
";
  echo "成绩" . $_POST[grade] . "
";
  if($grade>70)
  echo "你赢了!";
  if($grade   if($grade>88){echo "恭喜你!";}
  else{
  echo "下次努力!";
  }
  if($grade   echo "你太差了!";
  elseif($grade>70 && $grade   echo "水平一般!";
  elseif($grade>88 && $grade   echo "技术很好啊!";
  else
  echo "技术很好!";
}
?>


------解决方案--------------------
你弄反掉了,不是
$_POST[username]=$username; //获取提交的变量值
$_POST[grade]=$grade;

而是
$username = $_POST[username];
$grade = $_POST[grade];

$_POST是个特殊数组,提交的数据都放在里面,不要对它进行赋值
------解决方案--------------------
探讨

你弄反掉了,不是
$_POST[username]=$username; //获取提交的变量值
$_POST[grade]=$grade;

而是
$username = $_POST[username];
$grade = $_POST[grade];

$_POST是个特殊数组,提交的数据都放在里面,不要对它进行赋值
Statement:
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