Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Sending arrays to plugin function

Quote Reply
Sending arrays to plugin function
Hi there,

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>
Now, right above the form, I call the plugin function. I have added the code which I use to retrieve the data below:

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' => [
'',
''
],
};
My problem now, is that inside the foreach loop within the plugin, $id is not returning 7 or 8. instead, it is returning :

Code:
$VAR1 = [
'8',
'7'
];

Can anyone point me in the right direction? Frown

Thanks


Sacrifice is not about what you lose,
it is about what you gain in the process.
Quote Reply
Re: [EZFrag] Sending arrays to plugin function In reply to
Ever read through one of your older posts and wondered "What the hell was I blabbing about?"?


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

Last edited by:

EZFrag: Dec 17, 2009, 4:46 AM
Quote Reply
Re: [EZFrag] Sending arrays to plugin function In reply to
All the time Laugh

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates