ctcp Posted July 29, 2009 Share Posted July 29, 2009 <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 https://forums.phpfreaks.com/topic/167947-solved-text-menu/ Share on other sites More sharing options...
patrickmvi Posted July 29, 2009 Share Posted July 29, 2009 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 https://forums.phpfreaks.com/topic/167947-solved-text-menu/#findComment-885801 Share on other sites More sharing options...
ctcp Posted July 29, 2009 Author Share Posted July 29, 2009 thanks mate for the help .. but now working like Jump menu i need List menu Link to comment https://forums.phpfreaks.com/topic/167947-solved-text-menu/#findComment-885806 Share on other sites More sharing options...
patrickmvi Posted July 29, 2009 Share Posted July 29, 2009 I guess I don't understand what you mean by list menu... Link to comment https://forums.phpfreaks.com/topic/167947-solved-text-menu/#findComment-885808 Share on other sites More sharing options...
ctcp Posted July 29, 2009 Author Share Posted July 29, 2009 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 https://forums.phpfreaks.com/topic/167947-solved-text-menu/#findComment-885813 Share on other sites More sharing options...
ignace Posted July 29, 2009 Share Posted July 29, 2009 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 https://forums.phpfreaks.com/topic/167947-solved-text-menu/#findComment-885819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.