Gossamer Forum
Home : General : Perl Programming :

passing variables

Quote Reply
passing variables
this line: $output .= "<a href='$url&amp;do=owner&amp;oid=$owner'>Owner</a>";

calls this routine:
Code:
sub generate_owner_info {
#----------------------------------------------------------------------
#
my $tags = GT::Template->tags;
my $record = $tags->{owner}[$tags->{row_num}-1];
my $output = "<table border=0 cellpadding=1 cellspacing=2 width=100%>";

my $c = $tags->{home}->{sql}->table($tags->{home}->{cfg}->{'user_table_use'})->cols;
my $order;
foreach my $col ( sort {
defined ($c->{$a}->{pos}) or warn "No pos for $a\n";
defined ($c->{$b}->{pos}) or warn "No pos for $b\n";

$c->{$a}->{'pos'} <=> $c->{$b}->{'pos'}
} keys %$c ) {
($col =~ m/[_p]+/ or $col eq 'Password') and next;
$output .= "<tr><td width=20%>$col:</td><td width=80%>$record->{$col}</td></tr>";
}
return "$output</table>";
}
i want to add another link like the first one and have tried: $output .= "&nbsp;&nbsp;<a href='$url&amp;do=admin_form&amp;username=$owner'>Admin $owner</a>";

to call:

Code:
sub admin_form {
#---------------------------------------------------------------------
# show admin form
#
my ($self, $user, $msg) = @_;

return $self->home($self->_language('PER_ADMIN')) unless ( $self->{user}->{admin_p} );
$user = admin_init_hash($self->{user}) if ( !$user );
return ('admin_form.html', {
header => $self->_language('HEA_ADMIN'), %$user,
db => $self->{cgi}->{db},
password_confirm => $self->{cgi}->{password_confirm},
msg => $msg
});
}
the first line displays the user's info from the user table and works fine. i want the second line to bring up the admin form to change the selected user's info from the user table. but it always brings up the logged in user's info. pls help!
Quote Reply
Re: [delicia] passing variables In reply to
Hi,

What is the actual URL you see when trying to edit a users data? (if you don't see a "URL" with all the ?bla=whatever&something=whatever, then try installing the "Web Developer" plugin for Firefox ... then when you get to the form where it normally comes up with the link/button to get to the "user profile edit form", goto Forms > Convert Form Methods > POSTs to GETs, and lemme know the URL. Should hopefully be able to help you then :) (I basically just need to see what variables are passed in, so I can give you the code which should hopefully work Smile

Cheers

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!
Quote Reply
Re: [Andy] passing variables In reply to
when i click Admin in the menu, it brings up my info:

http://www.mywebsite/db.cgi?db=members&do=admin_form&user=1001

when i click my new Admin link next to the person's name:

http://www.mywebsite/db.cgi?db=members&do=admin_form&user=1003

since my (1001) info is displayed, it is apparently ignoring user=1003:
my ($self, $user, $msg) = @_;

return $self->home($self->_language('PER_ADMIN')) unless ( $self->{user}->{admin_p} );
$user = admin_init_hash($self->{user}) if ( !$user );
return ('admin_form.html', {
header => $self->_language('HEA_ADMIN'), %$user,
db => $self->{cgi}->{db},
password_confirm => $self->{cgi}->{password_confirm},
msg => $msg
});
}
Quote Reply
Re: [delicia] passing variables In reply to
Mmm, afraid that doesn't help me - sorry. Guess it would help if I have a copy to play around with, but I don't - sorry.

Cheers

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!
Quote Reply
Re: [Andy] passing variables In reply to
want me to send you the link and password?
Quote Reply
Re: [delicia] passing variables In reply to
Hi,

Sure, if you want (send to my email address though, I'm not a fan of PM's ;))

Also send me an example of the pages you are going to, and what you want to happen etc (and the lines of code you have been editing)

Cheers

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!
Quote Reply
Re: [Andy] passing variables In reply to
Hi,

Ok, can you try this:

Code:
sub admin_form {
#---------------------------------------------------------------------
# show admin form
#
my ($self, $user, $msg) = @_;

use Data::Dumper;
print $IN->header;
print Dumper($self, $user, $msg);


return $self->home($self->_language('PER_ADMIN')) unless ( $self->{user}->{admin_p} );
$user = admin_init_hash($self->{user}) if ( !$user );
return ('admin_form.html', {
header => $self->_language('HEA_ADMIN'), %$user,
db => $self->{cgi}->{db},
password_confirm => $self->{cgi}->{password_confirm},
msg => $msg
});
}

..so we can see what values are being passed in.

Cheers

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!