HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Populate a text field after making dropdown menu selection
Post new topic   Reply to topic    HTML Help Forum Index -> PHP
View previous topic :: View next topic  
Author Message
mukwano



Joined: 10 Jan 2008
Posts: 1

PostPosted: Thu Jan 10, 2008 12:41 pm     Populate a text field after making dropdown menu selection Reply with quote

Gurus,

I am a newbie and I need your help.

I have a form where I can list all the countries in the world in a drop down menu - the country list is picked up from the DataBase.

What I want to happen is when a Country is selected, it's corresponding Currency goes in the Currency text field automatically. The drop down works well, but what I can figure out is the next step.

Any suggestions?

I have searched the net for a solution to no avail:

Here below is a bit of the php code:

<?php
$result = @mysql_query("select * from Countries");
if (mysql_num_rows($result) > 0){
print "<select name=\"r_country\">";
while ($row = mysql_fetch_array($result)) {
print "<option value=\"" . $row['Currency'] . "\">" . $row['Country'] . "</option>\n";
}
print "</select>";
}

?>
123ecart



Joined: 13 Jan 2008
Posts: 2

PostPosted: Sun Jan 13, 2008 9:48 pm     re Reply with quote

Have you ever used ajax? It seems to work well for this kind of thing.

Barring that, you'll need to write a javascript function.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> PHP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial