Jump to content

[SOLVED] Text menu


ctcp

Recommended Posts

  <form method="GET" action="http://google.gr">
			  <input name="query1" type="text" id="inputString" autocomplete="off" onblur="fill();" onkeyup="lookup(this.value);" size="30" />
	      <label for="type"></label>
<select name="type" id="type">
  <option value="Games" <?php if (!(strcmp("Games", $type))) {echo "selected=\"selected\"";} ?>>Games</option>
  <option value="Apps" <?php if (!(strcmp("Apps", $type))) {echo "selected=\"selected\"";} ?>>Apps</option>
</select>
<button type="submit">Search</button>

How To..

if i select Games --> go to games.google.com

if i select Apps  --> go  to apps.google.com

Link to comment
Share on other sites

I'm not 100% sure what you're trying to do here but I think maybe this is what you'd want:

 

<select name="type" id="type" onChange="location.href='http://'+this.options[this.selectedIndex].value;">
  <option value="games.google.com">Games</option>
  <option value="apps.google.com">Apps</option>
</select>

Link to comment
Share on other sites

i got textfield for search ..

and list menu Games or Apps + search button ..

if i select Games

my search will go to games.google.com?query=mplamplampla

if i select Apps

my search will go to apps.xgoogle.com?query=mplamplampla

 

 

Link to comment
Share on other sites

Most would advice JavaScript and the onchange event, however for usabilities sake I discourage this, use this instead:

 

$query = $_POST['query'];
$type = $_POST['type'];
switch ($type) {
    case 'games':
        header('Location: http://games.google.com?q=' . $query);
        break;
    case 'apps':
        header('Location: http://apps.google.com?q=' . $query);
        break;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.