将html表单post数据传递到不同的文件/网页javascript变量(php)
所以我试图从我的文件将html表单post数据传递到不同的文件/网页javascript变量(php),javascript,php,html,forms,post,Javascript,Php,Html,Forms,Post,所以我试图从我的文件ResName.html 为什么不将数字传递给javascript变量?我怎样才能解决这个问题? numseatsbound是未正确接收数据的变量。这里有一些问题: 表单使用POST方法,但在下一个文件中检查GET变量。你应该在那里使用$\u POST['reseat'] 您正在发布到文件,而不是像http://localhost/...因此不涉及web服务器,您的php将不会被处理 您要发布到的脚本具有.html扩展名,因此即使您解决了第二个问题,也可能不会处理php &
ResName.html
为什么不将数字传递给javascript变量?我怎样才能解决这个问题?
numseatsbound
是未正确接收数据的变量。这里有一些问题:
$\u POST['reseat']
李>
http://localhost/...
因此不涉及web服务器,您的php将不会被处理李>
.html
扩展名,因此即使您解决了第二个问题,也可能不会处理php<head>
<form action="file:///E:/programs/portAppJavascript.html" method="post">
Name: <input id = 'name'>
<br>
Number of Reservations: <input type="text" id ='resseats' name="resseat">
<input type='submit' value="Choose Seats">
</form>
</head>`
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var isClicked = false;
var counter = 0;
var numSeatsBought = <?php $_GET['resseat'] ?>; //window.location.search; //change to get from other html page
var seatArray = new Array();
function clicked(clicked_id){
////////////////
var links = document.head.getElementsByTagName('link');
for(var link in links){
if(links.hasOwnProperty(link)){
var l = links[link];
if(l.rel === 'canonical'){
alert(l.href);
}
}
}