sergfuente@coiim.es has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm a new Spanish user and I am now learning Perl and I have one question. How can I refresh a scrolling list from the selected option of other scrolling list using data from a mysql database?"
For example, I have two scrolling lists and one of them is for select the country from a mysql database
The other scrolling list is about the States and it has to be refreshed by what the user has selected in the first scrolling list.
the code for the first scrolling list is easy but how I know the selected country and how I could refresh the data of the second scrolling list
print q(<select tabindex="3" name="country" my $dbh = DBI->connect('DBI:mysql:userxxxx', 'mysqldatabase', '*** +*****') || die "<p>Could not connect to database: $DBI::errstr</p>"; my $sth = $dbh->prepare('SELECT DISTINCT country FROM country ORDE +R BY country'); $sth->execute(); my $result; my $numero=1; print "<option value=\"0\">Please select an option</option>"; while ($result = $sth->fetchrow_array()) { print "<option value=\"$numero\"> $result</option>"; $numero++; } my $datom = param ( 'country' ); print "<p> $datom</p>"; $dbh->disconnect(); print "</select>\n<br>\n";
I believe that the answer must be easy... Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Refresh Scrolling List
by NetWallah (Canon) on Sep 11, 2012 at 23:53 UTC | |
by sergfuente@coiim.es (Initiate) on Sep 12, 2012 at 08:43 UTC | |
|
Re: Refresh Scrolling List
by Anonymous Monk on Sep 11, 2012 at 23:53 UTC | |
by sergfuente@coiim.es (Initiate) on Sep 12, 2012 at 08:27 UTC |