0
所以我想從我的文件ResName.html
經過HTML表單POST數據到不同的文件/網頁JavaScript變量(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>`
通過簡單的表格數據,以我的文件portAppJavascript.html
。我只是試圖將保留的數量傳遞給下面的一個js變量。
<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);
}
}
}
爲什麼它不會將數字傳遞給javascript變量?我怎樣才能解決這個問題? numSeatsBought
是沒有正確接收數據的變量。