> -----Original Message----- > From: Greg D. [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 30, 2002 12:42 PM > To: [EMAIL PROTECTED] > Subject: radio buttons > > > Ok i'm having problems getting information from the radio > button once it is > selected. > > this is the part that prints out the radio button.... > $dbh = DBI->connect($database, $username, $passwd) || die > "Error connecting" > .. $dbh->errstr; > $sth = $dbh->prepare("SHOW TABLES") || die "3: " . $dbh->errstr; > $sth->execute(); > while ($tablename = $sth->fetchrow_array){ > print "<input type=radio name=table > value=tablename>$tablename<br>" ^^^^^^^^^ this should be "$tablename", otherwise all the radio buttons will have the same value, namely the string 'tablename'.
> ; > > this is the part that is reading from the database once > someone clicks on one > of the buttons. I just wanted it to print out something to > show if is > working thats why i added the print data[1]....usually i > would just use the > array... > sub get_info { > print "Content-type: text/html\n\n"; > if ($tablename){ Somewhere you need to set $tablename to the value of the radio button, as in: $tablename = $q->param('table'); You *are* using CGI.pm, right? :) > > $dbh = DBI->connect($database, $username, $passwd) || die > "Error connecting" > .. $dbh->errstr; > $sth = $dbh->prepare("SELECT * from $tablename") || die "3: " > . $dbh->errstr; > $sth->execute(); > > while (my @data = $sth->fetchrow_array){ > print "$data[1]\n"; > > this part is is telling it after i hit submit to run the get > info sub routine > from above: > if (&check_password) { > if (!(param("submit"))){ > &print_header; > &print_buttons; > # &print_filter; > } else { > &get_info; > } > > > ANy help would be greatly appreciately. > thanks > greg > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]