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>

Is there a specific reason you want to use GET ?

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.

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

But i dont get the value of State

Appreciate your advice

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.

Yep Got this Worked in the PHP

Thank You so much
:)

No prob. Glad it worked out for ya.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.