Gossamer Forum
Quote Reply
Array ref... but WHY?
Anyone shed any light on why this keeps on returning an "array"?

Code:
sub {

my $field = $_[0]; # pass in as <%glboal_name("CountryName")%>
my $value = $IN->param($field);

my $schema = $DB->table('Links')->cols;

return '' if $schema->{$field}->{'form_type'} ne "SELECT";

my @form_names = split /\n/, $schema->{$field}->{'form_names'};
my @form_values = split /\n/, $schema->{$field}->{'form_values'};

my $back .= qq|<select name="$field">|;

for (my $i = 0; $i <= $#form_names; $i++) {
my $_name = $form_names[$i];
my $_val = $form_values[$i];
if ($value eq $form_values[$i]) {
$back .= qq|<option value="$_val" selected>$_name</option>|;
} else {
$back .= qq|<option value="$_val">$_name</option>|;
}
}

$back .= "</select>";


}

Sample output;

Code:
<select name="CountryName"><option value="ARRAY(0x84be214)">ARRAY(0x84bad70)</option></select>

I know that doing a print Dumper($schema->{$field}... and that gives;

Code:
$VAR1 = {
'not_null' => '0',
'form_type' => 'SELECT',
'form_size' => '',
'weight' => '',
'regex' => '',
'form_values' => [
'UK',
'USA',
'Israel',
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antarctica',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Australia',
'Austria',
'Azerbaijan',
'Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bermuda',
'Bhutan',
'Bolivia',
'Bosnia and Herzegovina',
'Botswana',
'Bouvet Island',
'Brazil',
'British Indian Ocean Territory',
'Brunei Darussalam',
'Bulgaria',
'Burkina Faso',
'Burundi'
],
'form_display' => 'CountryName',
'form_names' => [
'UK',
'USA',
'Israel',
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
'Antarctica',
'Antigua and Barbuda',
'Argentina',
'Armenia',
'Aruba',
'Australia',
'Austria',
'Azerbaijan',
'Bahamas',
'Bahrain',
'Bangladesh',
'Barbados',
'Belarus',
'Belgium',
'Belize',
'Benin',
'Bermuda',
'Bhutan',
'Bolivia',
'Bosnia and Herzegovina',
'Botswana',
'Bouvet Island',
'Brazil',
'British Indian Ocean Territory',
'Brunei Darussalam',
'Bulgaria',
'Burkina Faso',
'Burundi'
],
'file_save_in' => '',
'file_save_scheme' => 'HASHED',
'file_save_url' => '',
'pos' => '26',
'file_max_size' => '',
'size' => '255',
'type' => 'CHAR'
};

I really can't see why its doing this. Probably just a "stupid moment" ... Unsure

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Array ref... but WHY? Andy 1236 Sep 23, 2004, 1:55 AM
Thread Re: [Andy] Array ref... but WHY?
afinlr 1189 Sep 23, 2004, 10:51 AM
Post Re: [afinlr] Array ref... but WHY?
Andy 1188 Sep 23, 2004, 11:24 AM