这是第一页:Index.php
Definition fret_dec' (x : nat) : { fret x } + { ~ fret x }.
Proof. right. intros contra. contradiction. Defined.
Theorem hello_decide' : forall x : nat , count fret fret_dec' x = 0.
Proof.
induction x as [|x IH]; simpl.
- reflexivity.
- exact IH.
Qed.

第二页:Test2.php
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<form name="Index" action="Result.php" method="POST">
Username: <input type="text" name="username" id="username" autocomplete="off"><br><br> 1. I identify my gender as... <br>   
<input type="radio" name="gender" value="male">Male<br>   
<input type="radio" name="gender" value="female">Female<br>   
<input type="radio" name="gender" value="others">Others<br><br>
<input type="submit" a href="Test2.php" name="submit" value="Submit">
</form>
</body>
</html>
<?php
session_destroy();
?>
&#13;
第三页:Test3.php
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Test2</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<form action="Result.php" method="POST">
2. What is your age?<br>   
<input type="radio" name="age" value="14years">Under 14 years old<br>   
<input type="radio" name="age" value="15years">15-24 years old<br>   
<input type="radio" name="age" value="25years">25-59 years old<br>   
<input type="radio" name="age" value="60years">60-74 years old<br>   
<input type="radio" name="age" value="75years">Above 75 years old<br><br><br><br>
<input type="submit" a href="Test3.php" name="submit" value="Submit">
</form>
</body>
</html>
<?php
session_destroy();
?>
&#13;
这是收到三个php文件的最后一页&#39;值:Result.php:
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Test3</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<form action="Result.php" method="POST">
3. Please specify your ethnicity (race)<br>   
<input type="radio" name="race" value="chinese">Chinese<br>   
<input type="radio" name="race" value="malay">Malay<br>   
<input type="radio" name="race" value="indian">Indian<br>   
<input type="radio" name="race" value="others">Others<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
<?php
session_destroy();
?>
&#13;
结果是Result.php上的未定义索引。我在互联网上搜索并尝试不同的解决方案。之后,我认为我的每个表单中的按钮都有一些问题,但我找不到一些解决方案。所以对代码的一些解释对我来说将是一个很大的帮助。感谢。
答案 0 :(得分:0)
<form action="Report.php" method="GET">
Name: <input type=text name=username size=20><br><br>
</form>
// script
function GetParam(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
console.log(GetParam('username')); // will get the username query in the url
答案 1 :(得分:0)
您的GetParam(username)
正在接受参数,但在调用GetParam();
时您没有参数。删除username
表单GetParam(username)
您不能传递用户名,因为您是从查询字符串中获取的。
function GetParam() {
var start = location.search.indexOf("?" + username + "=");
if (start < 0) start = location.search.indexOf("&" + username + "=");
if (start < 0) return '';
start += username.length + 2;
var end = location.search.indexOf("&", start) - 1;
if (end < 0) end = location.search.length;
var result = '';
for (var i = start; i <= end; i++) {
var c = location.search.charAt(i);
result = result + (c == '+' ? ' ' : c);
}
return unescape(result);
}
result = GetParam();
username = unescape(result["username"]);
document.write("Hi " + username + "<br>");
使用PHP,您可以使用$_GET[]
<?php
if(isset($_GET["username"])){
print("Hi ".$_GET["username"]);
}
?>
答案 2 :(得分:0)
在html
中初始化如下表单<form method = "get" action="phpFileName.php">
<input type="text" value="" name="name" placeholder="name"/>
<input type="submit" value="submit" name="submit"/>
</form>
在你的php文件phpFileName.php脚本中如下
<?php
if(isset($_GET["submit"])){
print("Welcome ".$_GET["name"]);
}
?>