These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:24 pm Advanced search

html drop down box

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

html drop down box

Postby jokerboy123 » Mon Oct 03, 2011 12:45 am

I need help i dont know how to make a drop down box that functions like on this website. I dont want it as a form that i have to click submit, can it be down without php or mysql stuff? just basic html?

http://www.zarraffas.com/our-stores
jokerboy123
<h6>
 
Posts: 1
Joined: Mon Oct 03, 2011 12:41 am

Re: html drop down box

Postby JAB Creations » Mon Oct 03, 2011 11:57 am

That is a select element with a JavaScript onchange event (the onchange event is also an attribute in this case). If you do not want the redirect when changing the select element's value then simply do not include the onchange event.

The best way to get the select element to work in normal situations is to use the code the following way...

Code: Select all
<form action="" method="post">
<select name="this_appears_to_php">
<option value="value1">place1</option>
<option value="value2">place2</option>
<option value="value3">place3</option>
</select>
<input type="submit" value="press this button to submit the form" />
</form>


When you submit the form to PHP you can capture it the following way...

Code: Select all
<?php
if ($_SERVER['REQUEST_METHOD']=='GET')
{
//normal requests here
}
else if ($_SERVER['REQUEST_METHOD']=='POST')
{
if (isset($_POST['this_appears_to_php'])) {echo 'The value of your choice was '.$_POST['this_appears_to_php'].'.';}
}
?>
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 0 guests