Hey there all- been a while since I posted anything. I am having this problem with making a string from an array. The form I have has a multiple select box called sizes -
*****code******
$qrystr = "select from sizes";
$numresults= pg_exec($qrystr);
$numrows=pg_numrows($numresults);
echo" <SELECT SIZE=5 NAME=size[] MULTIPLE>";
for ($i =0; $i < $numrows; $i++) {
$id = pg_result($numresults,$i,0);
$size = pg_result($numresults,$i,1);
echo "<OPTION VALUE=$id>$size</OPTION>\n";
}
echo "</SELECT>";
?>
*************end code
when I have selected the appropriate sizes - I then have an array called sizes -
what i want to do it index the array but then make another variable have the value of that array as a string -
in essence what I want to achieve is
$sizes ="$size[1]+$size[2]"; etc.
However, since I have no idea how many boxes the user selected, I did the following -
this is the code that executes when posted --
*******code*********
for ($i=0; $i < count($size); $i++) {
$sizes += "$size[$i]";
echo $sizes, "|";
}
************end code
the result I get is
26660|53321|79983|
Hmm what I want outputed is
2660|2661|2663 etc.
then this string would be inserted into my size colum of the db - and later exploded to show a list of sizing options..
Could you please advise what I have to do to make this work..
I have been banging my head for hours on something that should be relatively easy..
Ray