Home: Perl Programming Help: Beginner:
Retrieving values from a checkbox



wicksy
Novice

May 16, 2007, 3:44 AM


Views: 507
Retrieving values from a checkbox

Hey all,
I'm currently working on a shopping cart type script that has a whole heap of songs ive written for sale.
I'm using checkboxes so that the user can check the ones they want to purchase and then when they submit the form the songs theyve clicked on enter into a database along with their cart ID and username.
The trouble i'm having is how do i retrieve the values that have been clicked on.

Below is the code that prints the checkboxes to the screen.
It is pulling each song from a database called songs.db.


Code
     while( my($songNum,$name,$price) = $sth->fetchrow_array) { 

print $q->checkbox_group(
-name=>$name,
-values=>[$name]);
print "<br />Price : $price</p>\n";

print "<br />\n";

}

print <<END_OF_HTML;
<input type="submit" value="purchase" />
END_OF_HTML


Basically i want to read the values that have been clicked on and put them in the database so that when u press purchase it brings up a new page which will read the songs from the database and display downloadable links to these songs.

Let me know if what i've asked doesnt make sense

Cheers everyone