Jump to content

List of countries


eristic

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.