Need a little help...

They have: 117 posts

Joined: Mar 2000

How do I include a variable in a form? Like this:

$FORM{'$variable'}
'

So that the name of the input is a variable.
Thanks!

--Edge

They have: 161 posts

Joined: Dec 1999

Perhaps you should leave off the single quotes.

$FORM{$variable};
'

If you're asking how to "come up" with the %FORM hash, I'd stay away from that, and use the standard CGI.pm module:

use CGI 'param';
# ...
print param($variable);
'

They have: 117 posts

Joined: Mar 2000

Nevermind, I found out how to do it. Smiling If anyone wants to know, here's how:

$FORM{\"$variable\"}
'

Thanks for trying anyway, japhy!

--Edge

They have: 161 posts

Joined: Dec 1999

The quotes around that variable name are TOTALLY unnecessary, and will only cause you trouble later, eventually.

$hash{$key}
'

is PERFECTLY fine, and is preferred over

$hash{"$key"}
'

Make a note of this!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.