|
Hi all much help needed??
I have had to develop a site in Perl that acts as a very basic e-commerce system whihc tracks items ordered in Cookies.
Code for adding cookies is shown below:
$cookie_value = $query->cookie('cycle');
#cookie value is called 'cycle'
$cycle_to_add = $query->param('cycleid');
if ($cookie_value)
{
$cookie_value = $cookie_value . ',';
}
$cookie_value = $cookie_value . $cycle_to_add;
$cookie_to_set = $query->cookie (-name => 'cycle',
-value => $cookie_value,
-expires=> '',
-path=> '/');
print $query->header(-cookie => $cookie_to_set);[/b]
What I am also looking to do is make it so that people can remove items from their shopping basket?
and having real problems in how to go about this.
Code for area of the shopping basket is shown below:
$sql = qq{SELECT name FROM stock WHERE item_id = ?};
$sth = $dbh -> prepare($sql);
@cycle_list = split /,/, $cookie_value;
print "<FORM METHOD=post ACTION=\"redirect.pl\">\n\n";
print "<CENTER><FONT FACE = \"arial, helvetica, sans\"><TABLE COLS=3>";
foreach $cycleid (@cycle_list)
{
$sth -> execute($cycleid);
($name) = $sth->fetchrow_array;
print "<TR><TD>$name</TD><TD></TD><TD><A HREF=remProduct.pl?id=$cycleid>REMOVE</A></TD></TR>\n";
}
print "</TABLE>\n";[/b]
So it will pass the Cycle ID to the remProduct Perl file I just dont know where to go from there?
If anyone can help would be really useful thanks all for reading, any more info needed please let me know??
|