我制作了自己的模块来将 php 表单的数据提交到数据库中。我现在有一篇文章里面的模块。
当我提交表单时,即使我有另一个模板页面可以成功提交,它也会进入 404 错误页面。
我曾尝试使用 action = post.php 以及确切的 URL,但它失败了。
有谁知道我出了什么问题?
这是网址:http ://aubrey-joomla-test.freeiz.com/index.php/new-user-registration-form
这是我的默认模板的文件名:default_tmpl.php
这是我的 tmpl 代码:
<div>
<form action="<?php echo JRoute::_('index.php'); ?>" method="post" id="myform" class="cols" >
<input type="hidden" name="form_send" value="send" />
<h2>New User Registration Form</h2>
<table>
<label>Are you employed?</label>
<tr>
<td><label><input type="radio" name="option" value="1" required="required">Yes</label></td>
<td><label><input type="radio" name="option" value="0" required="required">No</label></td>
</tr>
<label>If not, please proceed to the next section.</label>
</table>
<fieldset name="salary">
<h4>Income From Employment</h4>
<table> <tr><label>Pay cycle:</label>
<td><label><input type="radio" name="option1" value="1" required="required">Monthly</label></td>
<td><label><input type="radio" name="option1" value="2" required="required">Biweekly</label></td>
</tr> </table>
<p><label>Please enter your typical pay: <input type="text" name="amountpay" required="required" pattern="\d+(\.\d{2})?"/> </label></p>
<p><label>Please select your next pay day: <input type="date" name="paydate" required="required" /> </label></p>
</fieldset>
<fieldset name="fixeditems">
<h4>Fixed Items</h4>
<table> <label>Payment cycle:</label> <tr>
<td><label><input type="radio" name="option2" value="1" required="required">Monthly</label></td>
<td><label><input type="radio" name="option2" value="2" required="required">Biweekly</label></td>
<tr>
</table>
<table> <label>Is this a form of:</label> <tr>
<td><label><input type="radio" name="option3" value="2" required="required">Income</label></td>
<td><label><input type="radio" name="option3" value="1" required="required">Expense</label></td>
<tr>
</table>
<p><label>Please enter the typical amount: <input type="text" name="amount" required="required" pattern ="\d+(\.\d{2})?" /> </label></p>
<p><label>Please select the next due date: <input type="date" name="amountdate" required="required" /> </label></p>
</fieldset>
<hr>
<div class="clear"></div>
<button type="submit" name="send" value="Send">Submit form</button>
<button type="reset">Reset</button>
</form>
</div>