eristic Posted May 11, 2008 Share Posted May 11, 2008 I would like to create a list of countries that when clicked on it will go to a page for that country. Simple html should be on the other side, but I would like to use php or something similar to get them there. I found this source and many other like it: <TR> <TD NOWRAP class=textbasic>Country:</TD> </TR> <TR> <TD class=textbasic><table cellpadding="0" cellspacing="0"><tr><td width=200><SELECT NAME='MyFormcountry[]' class='textfield'><OPTION VALUE=''SELECTED>Select<OPTION VALUE='7'>Afghanistan <OPTION VALUE='8'>Albania <OPTION VALUE='9'>Algeria <OPTION VALUE='10'>American Samoa <OPTION VALUE='11'>Andorra <OPTION VALUE='12'>Angola <OPTION VALUE='13'>Anguilla etc. But I have no idea what to do with it! While I could look through tutorials, I know that you personally love solving problems and helping people. eristic Link to comment https://forums.phpfreaks.com/topic/105106-list-of-countries/ Share on other sites More sharing options...
xnowandtheworldx Posted May 11, 2008 Share Posted May 11, 2008 Well, you won't be able to do this is PHP you'll have to use javascript, i'm not fluent in javascript but i'll see if I can whip something up for yah. Link to comment https://forums.phpfreaks.com/topic/105106-list-of-countries/#findComment-538100 Share on other sites More sharing options...
xnowandtheworldx Posted May 11, 2008 Share Posted May 11, 2008 Here you go! This would be for pages on your website... <form action="../" name="country_list"> <select name="countries" onchange="window.location='page.php?country_id='+this.value"> //this will go to page.php?country_id=7 if you choose Afghanistan... <option value="">Choose a destination...</option> <option value="7">Afghanistan</option> <option value="8">Albania</option> <option value="9">Algeria</option> <option value="10">American Samoa</option> <option value="11">Andorra</option> </select> </form> If you want to redirect to another website... <form action="../" name="country_list"> <select name="countries" onchange="window.location=this.value"> <option value="">Choose a destination...</option> <option value="weblink">Afghanistan</option> <option value="weblink">Albania</option> <option value="weblink">Algeria</option> <option value="weblink">American Samoa</option> <option value="weblink">Andorra</option> </select> </form> So either way it's a butt load of work I would assume. If theres an easier way(which i'm sure there might be?) awesome. But this is all I could do. Link to comment https://forums.phpfreaks.com/topic/105106-list-of-countries/#findComment-538115 Share on other sites More sharing options...
GingerRobot Posted May 11, 2008 Share Posted May 11, 2008 You can find lists of them ready-made for you: http://www.guavastudios.com/country-list.htm Link to comment https://forums.phpfreaks.com/topic/105106-list-of-countries/#findComment-538135 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.