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;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.