On the page that this code is being submitted to I am trying to get each dynamically built field (from above) and place it into a variable via a loop.
foreach $files (@thefiles)
{
$NewTextEnteredForPics = $query->param('TextArea_$filename'); # comes from the Input text box
}
When the second page runs from the submit button on the first page, nothing is in [$NewTextEnteredForPics]. In fact it is empty. BUT I do have one static input form field on page 1
print "<input type='hidden' name='TheDirectoryEntered' value='$DirectoryTextBox'>";
and on the second page I have
my $DirectoryEntered = $query->param('TheDirectoryEntered');
This works. I can print out the contents of [$DirectoryEntered] But if I build several text boxes dynamically and populate them with different names then when it is submitted to the next page I cannot get the contents within the text boxes that I submitted. Why is this happening? What is the difference building a statis NAMED text box vs. one that is built in a loop?
Thanks for any help you can give.
Rob-
a-zA-Z0-9_ are all valid for scalar names
$filename and $filename_open are both valid scalars, so your code is looking for $filename_open and not finding it (I assume).
use concatenation or commas to build your text string:
print "<tr><td><input type='text' name='TextArea_" . $filename . "_open' value='Test></tr></td>";
or:
print "<tr><td><input type='text' name='TextArea_",$filename,"_open' value='Test></tr></td>";
although to me concatenation is more logical in this context. Makes sense?
foreach $files (@thefiles)
{
$NewTextEnteredForPics = $query->param('TextArea_$filename'); # comes from the Input text box
$filename maybe should be $files? And no single quotes around params() that have scalars in them:
$query->param("TextArea_$filename");
otherwise you kill the interpolation of the scalar and it becomes a literal string.
$NewTextEnteredForPics = $query->param('TextArea_$filename'); # comes from the Input text box
I cannot use single quotes here it has to be double quotes.
$NewTextEnteredForPics = $query->param("TextArea_$filename"); # comes from the Input text box.
and I took out the underscore in [TextArea_$filename_open] so it looks like [TextArea_$filename].
Thank you very much for the info. I feel like 10lbs has come off my shoulders. :)