admin管理员组文章数量:1426957
I am a WordPress beginner and want a help
I created a HTML dropdown list like this:
<select name="DropDownList1" id="DropDownList1">
<option value="select you location"> select your location</option>
<option value="cairo">Cairo</option>
<option value="alexanderia">Alexanderia</option>
<option value="aswan">Aswan</option>
<option value="port said">Port Said</option>
</select>
and also I created a HTML button like this:
<button type="button" name="restaurantpreview" type="submit" value="chefpreview">restaurantpreview</button>
I am trying to search about the code that I must use to :
when a user select a value from dropdown list
then the user click on my button
I get this value to my custom page and preview the list of restaurants in it
I am a WordPress beginner and want a help
I created a HTML dropdown list like this:
<select name="DropDownList1" id="DropDownList1">
<option value="select you location"> select your location</option>
<option value="cairo">Cairo</option>
<option value="alexanderia">Alexanderia</option>
<option value="aswan">Aswan</option>
<option value="port said">Port Said</option>
</select>
and also I created a HTML button like this:
<button type="button" name="restaurantpreview" type="submit" value="chefpreview">restaurantpreview</button>
I am trying to search about the code that I must use to :
when a user select a value from dropdown list
then the user click on my button
I get this value to my custom page and preview the list of restaurants in it
1 Answer
Reset to default 0You want to use admin-post.php
or admin-ajax.php
(AJAX only) to allow your front-end form to interact with WordPress.
Setting this up will allow you to create an action where you use the $_POST
array to find the content you're looking for with WP_Query
and print it out as the response to your request.
Here's a decent guide to both methods: https://premium.wpmudev/blog/handling-form-submissions/
本文标签: postsHow to invoke a HTML custom button based on a HTML dropdownlist menu
版权声明:本文标题:posts - How to invoke a HTML custom button based on a HTML dropdownlist menu 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745409752a2657411.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论