Apologies if this is a duplicate.
Below is how I pass a variable to my url;
<li><a href="blog-admin-users.php?source=add_users">Create Users</a></li>
From the above, my variable is source=add_users
and so the page can get it by checking $_GET[source]
.
How do I achieve this with a html form.
My form below;
<form method="post" action="nextpage.php" class="search-form">
<div class="grid-33 tablet-grid-33 mobile-grid-100">
<label for="cuisine">LOCATION</label>
<br/>
<div class="select-wrapper">
<select name="location" id="location-select">
<option value="0">Central</option>
<option value="1">Garki</option>
</select>
</div>
</div>
<div class="grid-33 tablet-grid-33 mobile-grid-50">
<label for="day">DAY</label>
<br/>
<div class="select-wrapper">
<select id="activity" name="activity" onchange="changeTime(this);">
<option value="0">Central</option>
<option value="1">Garki</option>
</select>
</div>
</div>
<div class="grid-33 tablet-grid-33 mobile-grid-50">
<label for="time">TIME</label>
<br/>
<div class="select-wrapper">
<option value="0">Central</option>
<option value="1">Garki</option>
</select>
</div>
</div>
<div id="availability-container" class="grid-100">
<input class="find" type="submit" value="FIND FOOD" id="searchfood">
<div class="error" id="notification"></div>
</div>
</form>
When a user clicks on submit, I want it to navigate to page
http://www.test.com/nextpage.php?location=1&day=today&time=12:00
My form has 3 select tags I want to pass the option the user selected to the next page in the url so the next page can use $_GET
to use them in a mysql query.
Thanks.