[英]Form action attribute does not work
提交表格時出現問題。 我的表單標簽看起來像-
<form method="post" action="classes/action.php" >
這不會重定向頁面。
任何想法??
更多代碼
<div class="grid_12">
<div class="grid_6 half-c half_m2" align="center" style="border-radius:100px 0 0 100px">
<form method="post" action="classes/action.php">
<table>
<tr>
<th colspan="2"><label class="eh1 eh1m">Login as Visitor</label> </th>
</tr>
<tr>
<td><br /></td>
<td></td>
</tr>
<tr>
<td><label class="eh2">Username</label></td>
<td><input type="text" name="txtVUname" class="etxt1 etxtm1"/></td>
</tr>
<tr>
<td><label class="eh2">Password</label></td>
<td><input type="password" name="txtVPwd" class="etxt1 etxtm1"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="btnVLogin" value="Login" style="float: right" /></td>
</tr>
</table>
</form>
</div>
<div class="grid_6 half-c half_m2" align="center" style="border-radius:0 100px 100px 0">
<form method="post" action="classes/action.php" >
<table>
<tr>
<th colspan="2"><label class="eh1 eh1m">Login as a Company</label></th>
</tr>
<tr>
<td><br /></td>
<td></td>
</tr>
<tr>
<td><label class="eh2">Username</label></td>
<td><input type="text" name="txtCUname" class="etxt1 etxtm1"/></td>
</tr>
<tr>
<td><label class="eh2">Password</label></td>
<td><input type="password" name="txtCPwd" class="etxt1 etxtm1"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="btnComLogin" value="Secure Login" style="float: right" /></td>
</tr>
</table>
</form>
</div>
</div>
文件夾結構看起來像-
mysite.com
- classes
- action.php
- login.php (containing form)
還有一件事情..我可以從具有表單和提交按鈕的另一個頁面上進行相同操作,以重定向到classes / action.php頁面上
你可以試試這個
<form method="post" action="./classes/action.php">
請注意,unix中的文件名區分大小寫!
您應該返回..因此,如果同一文件夾中的表單文件包含classes文件夾,則代碼將起作用;如果內部文件夾中的表單文件(如files / form_file.PHP)以及同一classes文件夾中的文件夾文件,則代碼將起作用是:
<form method="post" action="<?php echo $_SERVER['HTTP_HOST']; ?>/classes/action.php" >
等等。
非常簡單的錯誤而已。 替換表格動作並說出結果
<form method="post" action="../mywebsitename/classes/action.php" >
將action.php更改為action2.php並嘗試
<form method="post" action="../mywebsitename/classes/action2.php" >
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.