mmcw
asked on
Submitting values
<input type="checkbox" name="multilingual" value="english" >english
<input type="checkbox" name="multilingual" value="dutch" >dutch
<input type="checkbox" name="multilingual" value="french" >french
<input type="checkbox" name="multilingual" value="german" >german
In a script I use the checkbox option above.
When I submit the script:
The value $in{'mulitilingual'} becomes:
english dutch french german.
It looks like that the value are seperated by a space.
But I think it isn't so.
When I added the script manual and set the seperator to a space the script works fine. Further on in the script the value $in{'mulitilingual'} will be split using a space as a seperator!!
When the script will try to split the value made by the form the value $in{'mulitilingual'} will not be split but stays as one value:
english dutch french german
Can someone help me??
greetings Michel
<input type="checkbox" name="multilingual" value="dutch" >dutch
<input type="checkbox" name="multilingual" value="french" >french
<input type="checkbox" name="multilingual" value="german" >german
In a script I use the checkbox option above.
When I submit the script:
The value $in{'mulitilingual'} becomes:
english dutch french german.
It looks like that the value are seperated by a space.
But I think it isn't so.
When I added the script manual and set the seperator to a space the script works fine. Further on in the script the value $in{'mulitilingual'} will be split using a space as a seperator!!
When the script will try to split the value made by the form the value $in{'mulitilingual'} will not be split but stays as one value:
english dutch french german
Can someone help me??
greetings Michel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
first you get the variables into one
var.
then use ~s to replace it.
or use split.
i recommd you had better use one var get the variable from the form.
var.
then use ~s to replace it.
or use split.
i recommd you had better use one var get the variable from the form.
first you get the variables into one
var.
then use ~s to replace it.
or use split.
i recommd you had better use one var get the variable from the form.
if you still have problem,you can show me some code of this script.
thank you..
var.
then use ~s to replace it.
or use split.
i recommd you had better use one var get the variable from the form.
if you still have problem,you can show me some code of this script.
thank you..
How is %in set in your script?
ASKER
Answer to ozo:
I use cgi-lib
I use cgi-lib
What version? Could you post the relevent code?
I think most will separate the values with "\0" in a single scalar string
if you use CGI.pm, (which I'd recommend) it will return the parameters in an array.
I think most will separate the values with "\0" in a single scalar string
if you use CGI.pm, (which I'd recommend) it will return the parameters in an array.
ASKER
This is the version that is used by my script!
# Perl Routines to Manipulate CGI input
# S.E.Brenner@bioc.cam.ac.uk
# $Id: cgi-lib.pl,v 2.8 1996/03/30 01:36:33 brenner Rel $
#
# Copyright (c) 1996 Steven E. Brenner
# Unpublished work.
# Permission granted to use and modify this library so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the library.
#
# Thanks are due to many people for reporting bugs and suggestions
# especially Meng Weng Wong, Maki Watanabe, Bo Frese Rasmussen,
# Andrew Dalke, Mark-Jason Dominus, Dave Dittrich, Jason Mathews
# For more information, see:
# http://www.bio.cam.ac.uk/cgi-lib/
greetings Michel
# Perl Routines to Manipulate CGI input
# S.E.Brenner@bioc.cam.ac.uk
# $Id: cgi-lib.pl,v 2.8 1996/03/30 01:36:33 brenner Rel $
#
# Copyright (c) 1996 Steven E. Brenner
# Unpublished work.
# Permission granted to use and modify this library so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the library.
#
# Thanks are due to many people for reporting bugs and suggestions
# especially Meng Weng Wong, Maki Watanabe, Bo Frese Rasmussen,
# Andrew Dalke, Mark-Jason Dominus, Dave Dittrich, Jason Mathews
# For more information, see:
# http://www.bio.cam.ac.uk/cgi-lib/
greetings Michel
ASKER
Maybe I try to explain what I do with the output of the form above:
I write the variable $in{'multilingual'} directly to a file.
When I make a line in my program waht prints the output to the screen, the result is: english dutch french german
It looks like there are space between each option!!
But when I try to use the file where I wrote the $in{'multilingual'} variable to and try to split each option by space,
Something like this:
@r_options = split(/ /,$row[3]);
Where $row[3] is the place where I wrote the variable $in{'multilingual'} to.
it will not work!!!
$r_option[0] = english dutch french german
and
$r_option[1] =
$r_option[2] =
$r_option[3] =
Last option are empty!!
Hope you can help me!!
I write the variable $in{'multilingual'} directly to a file.
When I make a line in my program waht prints the output to the screen, the result is: english dutch french german
It looks like there are space between each option!!
But when I try to use the file where I wrote the $in{'multilingual'} variable to and try to split each option by space,
Something like this:
@r_options = split(/ /,$row[3]);
Where $row[3] is the place where I wrote the variable $in{'multilingual'} to.
it will not work!!!
$r_option[0] = english dutch french german
and
$r_option[1] =
$r_option[2] =
$r_option[3] =
Last option are empty!!
Hope you can help me!!
This Script is test work ok.
$raw[3]="english dutch french german";
@r_options = split(/ /,$raw[3]);
print "
$r_options[0] =
$r_options[1] =
$r_options[2] =
$r_options[3] =";
maybe you need do it again.
@r_options = split(/ /,$raw[3]);
@r_option=split(/ /,$r_options[0]);
or
use
@r_options = split(/\0/,$raw[3]);
$raw[3]="english dutch french german";
@r_options = split(/ /,$raw[3]);
print "
$r_options[0] =
$r_options[1] =
$r_options[2] =
$r_options[3] =";
maybe you need do it again.
@r_options = split(/ /,$raw[3]);
@r_option=split(/ /,$r_options[0]);
or
use
@r_options = split(/\0/,$raw[3]);
ASKER
The \0 option did work
ASKER
I think the form does not use spaces???