2017-05-11 27 views
-1

我需要下面的HTML文件來連接到不同的PHP文件,因爲它們連接到數據庫中的不同表。我已經使用JAVA Script來按下按鈕時提交動作,但無論如何,該文件只會連接到Prepared.php文件,並且永遠不會連接到Prepared2.php文件。我試着用不同的標籤和許多其他的概念,但似乎無法讓文件起作用。獲取HTML文件以連接到依次連接到mysql數據庫的文件

請找到下面的代碼:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
     <meta charset="utf-8" /> 
     <title> BBC Database search </title> 

</head> 
<body> 
<center> 
<h1> BBC Database search </h1> 
<script type="text/javascript"> 
function submitAction(act) { 
    document.sample.action = act; 
    document.sample.submit(); 

    } 
    </script> 

<form action="Prepared.php" method="post"> 
Search Brands: <input type="text" name="term" 
onClick="submitAction('Prepared.php')"/><br /> 
<input type="submit" value="Submit" /> 

<form action="Prepared2.php" method="post"> 
Search Available Clips: <input type="text" name="clips" 
onClick="submitAction('Prepared2.php')" /><br /> 
    <input type="submit" value="Submit" /> 
    </center> 
    </form> 
+0

沒有PHP或MySQL這裏已經這使得這個問題不清楚。 –

+0

你也沒有關閉第一個表格。 –

回答

0

JS代碼是完全不必要的,錯誤的,刪除它和的onsubmit。

然後用</form>關閉第一<form>標籤目前您已在第一第二的形式和那不是法律

<!DOCTYPE html> 
<html lang="en"> 
<head> 
     <meta charset="utf-8" /> 
     <title> BBC Database search </title> 

</head> 
<body> 
<center> 
<h1> BBC Database search </h1> 
<form action="Prepared.php" method="post"> 
    Search Brands: <input type="text" name="term" /> 
    <br /> 
    <input type="submit" value="Submit" /> 
</form> 

<form action="Prepared2.php" method="post"> 
    Search Available Clips: <input type="text" name="clips" /> 
    <br /> 
    <input type="submit" value="Submit" /> 
</form>