Hi there,
I am having a problem sending arrays to a plugin via a form post.
Here is the layout of the form:
<form action="page.cgi" method="post">
<select name="niche_id">
<option value="">Select Niche...</option>
<option value="6">Industrial</option>
<option value="5">Business</option>
<option value="9"> Clothing</option>
<option value="10">Bathroom</option>
<option value="12">Home</option>
<option value="13"> Kitchen</option>
</select>
<table border="1">
<tr>
<th>Widget</th><th>Region</th><th>Weight</th><th>Function</th>
</tr>
<tr>
<td style="padding: 5px;">Mailing List</td>
<td style="padding: 5px;">rightsidebartop</td>
<td style="padding: 5px;">
<input type="hidden" value="7" name="nwid"/>
<input type="text" value="" name="weight" style="width: 25px;"/>
</td>
<td style="padding: 5px;">
<input type="checkbox" value="7" name="delete"/> Delete
</td>
</tr>
<tr>
<td style="padding: 5px;">Social Bookmarking</td>
<td style="padding: 5px;">rightsidebartop</td>
<td style="padding: 5px;">
<input type="hidden" value="8" name="nwid"/>
<input type="text" value="" name="weight" style="width: 25px;"/>
</td>
<td style="padding: 5px;">
<input type="checkbox" value="8" name="delete"/> Delete
</td>
</tr>
<tr><td/><td/><td/><td><input type="submit" value="Apply" name="applyfunction"/></td></tr>
</table>
</form>Now, right above the form, I call the plugin function. I have added the code which I use to retrieve the data below:
my $args = shift || $IN->get_hash;
my @nwid = $args->{'nwid'};
foreach my $id(@nwid){
print Dumper($id);
}
Here is a dump of $args:
$VAR1 = {
'applyfunction' => 'Apply',
'niche_id' => '13',
'nwid' => [
'8',
'7'
],
'weight' => [
'',
''
],
};My problem now, is that inside the foreach loop within the plugin, $id is not returning 7 or 8. instead, it is returning :
'8',
'7'
];
Can anyone point me in the right direction?
Thanks
Sacrifice is not about what you lose,
it is about what you gain in the process.
I am having a problem sending arrays to a plugin via a form post.
Here is the layout of the form:
Code:
<form action="page.cgi" method="post">
<select name="niche_id">
<option value="">Select Niche...</option>
<option value="6">Industrial</option>
<option value="5">Business</option>
<option value="9"> Clothing</option>
<option value="10">Bathroom</option>
<option value="12">Home</option>
<option value="13"> Kitchen</option>
</select>
<table border="1">
<tr>
<th>Widget</th><th>Region</th><th>Weight</th><th>Function</th>
</tr>
<tr>
<td style="padding: 5px;">Mailing List</td>
<td style="padding: 5px;">rightsidebartop</td>
<td style="padding: 5px;">
<input type="hidden" value="7" name="nwid"/>
<input type="text" value="" name="weight" style="width: 25px;"/>
</td>
<td style="padding: 5px;">
<input type="checkbox" value="7" name="delete"/> Delete
</td>
</tr>
<tr>
<td style="padding: 5px;">Social Bookmarking</td>
<td style="padding: 5px;">rightsidebartop</td>
<td style="padding: 5px;">
<input type="hidden" value="8" name="nwid"/>
<input type="text" value="" name="weight" style="width: 25px;"/>
</td>
<td style="padding: 5px;">
<input type="checkbox" value="8" name="delete"/> Delete
</td>
</tr>
<tr><td/><td/><td/><td><input type="submit" value="Apply" name="applyfunction"/></td></tr>
</table>
</form>
Code:
my $args = shift || $IN->get_hash;
my @nwid = $args->{'nwid'};
foreach my $id(@nwid){
print Dumper($id);
}
Here is a dump of $args:
Code:
$VAR1 = {
'applyfunction' => 'Apply',
'niche_id' => '13',
'nwid' => [
'8',
'7'
],
'weight' => [
'',
''
],
};
Code:
$VAR1 = [ '8',
'7'
];
Can anyone point me in the right direction?

Thanks
Sacrifice is not about what you lose,
it is about what you gain in the process.