Baffled has asked for the wisdom of the Perl Monks concerning the following question:
Ok. First some preamble. I have a webpage that is loaded with a users saved CSV file containing a database of items, each row is one item with 15 fields of designated information about that item.
On this page the file is read and using a foreach loop to print out a small form for each item. Each form field is prefilled using the $title, $price, $shipping ect variables from the csv file.
Form for item one
title, price, size, shipping
form for item two
title, price, size, shipping
form for item three
title, price, size, shipping
form for item four
title, price, size, shipping
and so on until all lines are read.
I wish to have it so when a user edits the title for a item and pushes a save button it re-writes the CSV file with any new changes made. I was trying something like the following but I know its all wrong. When called it returns like as if it worked but yet nothing actually happens
my ($title, $reserve, $inc, $desc, $image1, $image2, $image3, $image4) $form{'RETURNPOLICY'} =~ s/\</\<\;/g; $form{'RETURNPOLICY'} =~ s/\>/\>\;/g; $form{'item'} = $rdata5; foreach $invrecord (@allrecords){ open (NEWSHT, ">>$config{'basepath'}$config{'inventory'}/spreadshe +ets/$form{'item'}.dat") or die "Could not edit your inventory spreads +heet file :$!\n"; print NEWSHT "$form{'TTITLE'}$fielddelimiter$form{'RESERVE +'}$fielddelimiter$form{'INC'}$fielddelimiter$form{'DESC'}$fielddelimi +ter$form{'IMAGE1'}$fielddelimiter$form{'IMAGE2'}$fielddelimiter$form{ +'IMAGE3'}$fielddelimiter$form{'IMAGE4'}"; close NEWSHT; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Passing Multi Form Page as array to write CSV file
by NetWallah (Canon) on Jan 09, 2013 at 04:59 UTC | |
by Baffled (Acolyte) on Jan 09, 2013 at 23:33 UTC |