PHP 表单未在特定页面上提交,相同的代码
PHP Form not submitting on specific pages, same code
我有以下表单代码:
<form method=post action='/zoeken.php'>
<div style='position: relative;'>
<input type=search name=zoeken_opdracht placeholder='Zoeken...' value="<?php echo $_POST['zoeken_opdracht']; ?>">
<button name=zoeken><i class='fa fa-search'></i></button>
</div>
</form>
但是,当我在特定页面上提交时,它没有提交。但是,相同的代码在所有其他页面(无产品页面)上都可以正常工作。
在此处查看产品页面示例:
Productpage (Form not working)
您可以在除产品页面以外的任何其他页面上找到其他表格。例如主页。
将 button
更改为 submit
注意类型search
、形式method
、部分name
和style
有错误
<form method="post" action="/zoeken.php">
<div style="position:relative;">
<input type="search" name="zoeken_opdracht" placeholder="Zoeken..." value="<?php echo $_POST['zoeken_opdracht']; ?>">
<input type="submit" name="zoeken"><i class="fa fa-search"></i>
</div>
</form>
<form method=post action='/zoeken.php'>
<div style='position: relative;'>
<input type="search" name="zoeken_opdracht" placeholder='Zoeken...' value="<?= $_POST['zoeken_opdracht']; ?>">
<button type="submit" name=zoeken><i class='fa fa-search'></i></button>
</div>
</form>
问题已解决。我发现我的 javascript 代码中有一个 preventDefault 也会在提交搜索表单时触发。我解决了这个问题,现在它就像一个魅力。
感谢
我有以下表单代码:
<form method=post action='/zoeken.php'>
<div style='position: relative;'>
<input type=search name=zoeken_opdracht placeholder='Zoeken...' value="<?php echo $_POST['zoeken_opdracht']; ?>">
<button name=zoeken><i class='fa fa-search'></i></button>
</div>
</form>
但是,当我在特定页面上提交时,它没有提交。但是,相同的代码在所有其他页面(无产品页面)上都可以正常工作。
在此处查看产品页面示例: Productpage (Form not working)
您可以在除产品页面以外的任何其他页面上找到其他表格。例如主页。
将 button
更改为 submit
注意类型search
、形式method
、部分name
和style
<form method="post" action="/zoeken.php">
<div style="position:relative;">
<input type="search" name="zoeken_opdracht" placeholder="Zoeken..." value="<?php echo $_POST['zoeken_opdracht']; ?>">
<input type="submit" name="zoeken"><i class="fa fa-search"></i>
</div>
</form>
<form method=post action='/zoeken.php'>
<div style='position: relative;'>
<input type="search" name="zoeken_opdracht" placeholder='Zoeken...' value="<?= $_POST['zoeken_opdracht']; ?>">
<button type="submit" name=zoeken><i class='fa fa-search'></i></button>
</div>
</form>
问题已解决。我发现我的 javascript 代码中有一个 preventDefault 也会在提交搜索表单时触发。我解决了这个问题,现在它就像一个魅力。
感谢