Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with Cobmo Box Posting URL

Posted on 2004-04-26
3
Medium Priority
?
168 Views
Last Modified: 2008-03-10
I am kind new to PHP and learning quick.  But I ran into a speed bump.

I have a combobox that fills with the contents from a MySQL DB.  I want to be able to select an option in the combobox click the go button and go to a url based on the selection of the combobox.

Here is what i currently have:


....code
print("<form name=form1 method=post style=display: inline; margin: 0; padding: 0;>");
print("<select name=select>");
while ($row = mysql_fetch_array ($result))
      {  
      print("<option value=cat4.php?GEN=$gender&BR=".urlencode(stripslashes($row[BRAND])).">".stripslashes($row[BRAND])."</option>");
      }
  print("<input type=submit value=go></select></form>");

// Close the access to mysql database
mysql_close ($link);
print ("</p></font></td></tr>\n");
print ("</table>\n");
?>


The answer is probably easy but I'm giving 125pts because I want to get this little thing done.

Thanks
0
Comment
Question by:dspavlik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
Yasir_Malik earned 500 total points
ID: 10920656
You need some JavaScript magic:

print("<form name=form1 method=post style=display: inline; margin: 0; padding: 0;>");
print("<select name=select>");
while ($row = mysql_fetch_array ($result))
     {  
     print("<option value=cat4.php?GEN=$gender&BR=".urlencode(stripslashes($row[BRAND])).">".stripslashes($row[BRAND])."</option>");
     }
  print('<input type="submit" value="go" onsubmit="location.href=form1.select.options[selectedIndex].value"></select></form>');

I would recommend enclosing all your attributes in quotes ("" "") like I've done.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question