2016-05-19 21 views
-3

我會盡量做到儘可能具體,但這很難,因爲我不知道發生了什麼。所以,當我值插入我的「輸入」,並點擊提交按鈕,我的PHP頁面都到了PHP註冊頁面(因爲我的投入使用「後」),然後用JavaScript的再次發回:爲什麼我的網頁在輸入數據庫後變爲空白?

<script> window.open("Addmovie.php?tittel=","_self") </script>

但是當它被髮回時,我的頁面會轉到相同的「URL」,但它顯示一個幾乎空白的頁面,只有挪威語中的「hi」,我的輸入會被註冊,但如果我刷新頁面, + F5它仍然沒有顯示任何東西。如果我轉到我的網站上的另一個頁面,然後再返回,我可以看到我的輸入已註冊。我認爲「嗨」部分來自我的提供者,因爲我之前以無關方式遇到此消息時沒有任何顯示。

我在網站上輸入/如何應該看起來

enter image description here

頁我回去後,我打提交

enter image description here

如果我真的感到困惑,是我已經能夠輸入值到我的數據庫之前,它只是現在我變回空。我可以發佈我的代碼,但我不知道要發佈什麼內容。

對於這樣的registerlooks輸入文件:

<html> 
<head> 
</head> 
<body> 
    <h3>Add a movie</h3> 
    <form action="movieregister.php" method="post" enctype="multipart/form-data"> 
    <p> 
     <label>Title: </label><input type="text" name="tittel"> 
    </p> 
    <p> 
     <label>Year: </label><input type="text" name="aar"> 
    </p> 
    <p> 
     <label>Genre: </label><input type="text" name="genre"> 
    </p> 
    <p> 
     <label>Description: </label> 
     <br><textarea rows="5" <input type="text" name="plot"></textarea> 
    </p> 
    <p>Select image to upload: 
     <input type="file" name="fileToUpload" id="fileToUpload"> 
    </p> 
    <input type="submit"> 
</form> 
</body> 
</html> 

我的寄存器:

<?php 
else { 
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)||$tittel==""||$aar==""||$genre==""||$plot=="") { 
     $db=mysqli_connect("$host","$user","$database","$password","$port"); 
    $sql="INSERT INTO gruppe3_film (tittel, aar, genre, plot) VALUES ('$tittel','$aar','$genre','$plot')"; 
    $result=mysqli_query($db,$sql); 
    echo "The file ". basename($_FILES["fileToUpload"]["name"]). " has been uploaded."; 
    } else { 
     echo "Sorry, there was an error uploading your file."; 
    } 
} 
$db->close() 
?> 
<script> 
    window.open("Addmovie.php?tittel=","_self") 
</script> 

請,如果你想/需要一些信息問了。提前感謝任何答案。

+0

那麼PHP和html進入圖片的位置?並且你提到了一個數據庫,但沒有代碼來支持這個問題。我只能在這裏說......檢查錯誤。 –

+0

死亡白人屏幕? http://stackoverflow.com/questions/1475297/phps-white-screen-of-death – CD001

回答

0

我通過移除

<script> 
    window.open("Addmovie.php?tittel=","_self") 
</script> 

固定的問題,而是我去了頁面的頂部,並使用了頭

header("Refresh:5; url=AddMovie.php?tittel="); 

這解決了問題,但我仍然不知道爲什麼這個「劇本」造成了它。或者如果它是它自己的命令

相關問題