Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable problem! 1

Status
Not open for further replies.
Feb 16, 2003
87
GB
Hi Folks,

I have some information passed to a script from a form.

$query->param('tlds') grabs that info which is actually made up of some checkbox information, ie

<input type=&quot;checkbox&quot; name=&quot;tlds&quot; value=&quot;.com&quot;>.com
<input type=&quot;checkbox&quot; name=&quot;tlds&quot; value=&quot;.net&quot;>.net
<input type=&quot;checkbox&quot; name=&quot;tlds&quot; value=&quot;.org&quot;>.org

then the script does this:

@tlds3 = $query->param('tlds');

BUT - I want to hard code the tlds into the script but this doesn't work:

@tlds3 = &quot;.com.net.org&quot;;

Any ideas why not??

Simon
 
I would guess that it works if you only click 1 checkbox right? If you check more than that then it dies right? if so the reason is you are naming the checkboxes all the same

so when the key value pairs are called it only returns 1 item from the set.

a possible solution is to create a hidden field that changes when each is checkbox is checked and unchecked
and pass that to the script or rename the checkboxes uniquely and pass then to a new array or a multiple selection list. etc etc
 
Hi Arcnon -

Not quite - it works no matter how many checkboxes are ticked.

I will be getting rid of the form altogether hence the need for hardcoding.

Any more ideas folks?

Simon
 
@tlds3 = &quot;.com.net.org&quot;;

I'm not sure what you expect by initializing an array with a scalar, it doesn't make sense.

Depending on what you want in that array, maybe @tlds3 = qw(.com .net .org) ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top