我在我的網站上有一個表格(http://hokuco.com/test/)。它創建一個文件夾與PHP,但自從我安裝了一個JavaScript我的PHP不工作。 javascript重定向到php創建的文件夾。具有諷刺意味的是,在我做JavaScript的工作之前,PHP的作品。PHP不工作在js形式
注重看起來像這樣的兩個障礙之間的區域:
<!--===========-->
的index.php:
<?php
function recurse_copy($src,$dst) {
$dir = opendir($src);
@mkdir($dst);
while(false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src . '/' . $file)) {
recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
}
}
}
closedir($dir);
}
$src = "./xe7";
$dst = $_POST['foldername'];
recurse_copy($src,$dst);
?>
<link rel="stylesheet" type="text/css" href="style.css" />
<div>
<body onload="timer=setTimeout('removeControls();',3)">
<h1>Drawblog</h1>
<div class="FAQ" style ="box-shadow: 1px 1px 3px rgba(0,0,0,0);">
<a href="#hide1" class="hide" id="hide1">Controls</a>
<a href="#show1" class="show" id="show1">-</a>
<div class="list" style ="box-shadow: 1px 1px 3px rgba(0,0,0,0);">
<!--===========-->
<form method="post" id ="form" action ="index.php">
<input type="text" name="foldername" id ="togl">
<input type="submit" name="submit" value="Create panorama">
<script type="text/javascript">
window.onload = function() {
document.getElementById("form").onsubmit = function() {
var folder = document.getElementById("togl").value;
window.location.href ="http://hokuco.com/test/" + folder + "/toggle.php";
return false;
}
}
</script>
\t </form>
<!--===========-->
<h3>Or,</h3>
<h2>Login with an access code(the account you just typed into the box above, or a code someone shared with you)</h2>
<input type="text" id="field" />
<button id="submit">Go</button>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
document.getElementById("submit").addEventListener("click", function(){
var folder = document.getElementById("field").value;
var url = "http://hokuco.com/test/" + folder + "/index.html";
window.location.href = url;
});
</script>
\t </div>
</div>
<h1> </h1>
<h1> </h1>
<p>make shocking panoramas in minutes, no account needed</p>
<br/>
<br/>
<br/>
<br/>
<p>special thanks to:</p>
\t \t <div id="info"><a href="http://threejs.org" target="_blank">three.js css3d</a> - panorama.</div>
\t <h5>a hokuco company</h5>
</div>
請參閱如何創建[mcve] – j08691
我想可能是因爲您發佈的腳本太大,原因是您嘗試清除所有不相關的代碼,以使您的代碼片段更輕鬆閱讀...請記住,當你這樣做時,你可能會無意中發現問題... – dsdsdsdsd
當'onsubmit'函數返回'false'時,這會阻止表單提交,所以'$ _POST ['foldername']] '沒有設置。 – Barmar