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/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745409753a4626475.html
评论列表(0条)