0

How to get value from Dropdown and text values Please advice

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="tst.php" method="GET">
Input Keyword: <input type="text" name="q" style="width:200px;">
          <input type="submit" value="Search">
          </form>
<select>
                   <option value="SC">South Carolina</option>
                        <option value="SD">South Dakota</option>
                        <option value="TN">Tennessee</option>
                        <option value="TX">Texas</option>
                         <option value="Alaska Area">Alaska Area</option>
                         </select>
               
</body>
</html>
2
Contributors
6
Replies
9
Views
8 Years
Discussion Span
Last Post by CFROG
0

It looks like your dropdown is sitting outside of your form. Your selection won't submit that way. You also want to add a name to your select tag.

form action="tst.php" method="GET">
Input Keyword: <input type="text" name="q" style="width:200px;">
                 <select name"state" >
                        <option value="SC">South Carolina</option>
                        <option value="SD">South Dakota</option>
                        <option value="TN">Tennessee</option>
                        <option value="TX">Texas</option>
                         <option value="Alaska Area">Alaska Area</option>
                  </select>
 <input type="submit" value="Search">
          </form>

That should work out a little better for ya.

Edited by CFROG: forgot to add something

0

CF
I get $_GET[Q] = the value of text typed

But i dont get the value of State

Appreciate your advice

0

I missed the = in the select tag between name and "state." Change it to <select name="state">. Sorry 'bout that. Give it another try, no reason i can see that it shouldn't work.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.