?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Re: keywords, checkbox array search
Author:??(---.cpe.net.cable.roger)
Date:???07-21-03 17:41

missing the array element indices (the square brackets with the vars inside (ie [0]([zero]),[$x],[$y],[$z]) in the area where you are iterating thru the array...i have paced them in...wish i could show 'em in some format like bold or color...sorry


if ($num_ext==1){
$ext_type="'".$_POST['extension'][0]."'";
}elseif ($num_ext>1){
for ($x=0;$x<$num_ext;$x++){
if ($x==0){
//first element so no comma separator needed
$ext_type.="'".$_POST['extension'][0]."'";
}else{
//add the comma separator
$ext_type.=",'".$_POST['extension'][$x]."'";
print "$ext_type ext_type
";
} //close if then
}//close for loop
}else{
//no elements so set to "na"
$ext_type="na";
}
print "$x x value
";
print "$ext_type ext_type
";

$num_img=count($_POST['image_type']);
print "$num_img num_img
";//a test to try to identify problem
if ($num_img==1){
$img_type="'".$_POST['image_type'][0]."'";
}elseif ($num_img>1){
for ($y=0;$y<$num_img;$y++){
if ($y==0){
//first element so no comma separator needed
$img_type.="'".$_POST['image_type'][$y]."'";
}else{
//add the comma separator
$img_type.=",'".$_POST['image_type'][$y]."'";
print "$img_type img_type
";
} //close if then
}//close for loop
}else{
//no elements so set to "na"
$img_type="na";
}
print "$y y value
";
print "$img_type img_type
";


$num_sub=count($_POST['subject']);
print "$num_sub num_sub
";
if ($num_sub==1){
$sub_type="'".$_POST['subject'][0]."'";
}elseif ($num_sub>1){
for ($z=0;$z<$num_sub;$z++){
if ($z==0){
//first element so no comma separator needed
$sub_type.="'".$_POST['subject'][$z]."'";
}else{
//add the comma separator
$sub_type.=",'".$_POST['subject'][$z]."'";
print "$sub_type sub_type
";
} //close if then
}//close for loop
}else{
//no elements so set to "na"
$sub_type="na";
}
print "$z z value
";
print "$sub_type sub_type
";

?Topics Author? Date
?keywords, checkbox array search??new
Truly 07-05-03 12:47?
?Re: keywords, checkbox array search??new
bastien 07-06-03 07:10?
?Re: keywords, checkbox array search??new
Truly 07-08-03 10:20?
?Re: keywords, checkbox array search??new
bastien 07-09-03 19:00?
?Re: keywords, checkbox array search??new
Truly 07-09-03 20:54?
?Re: keywords, checkbox array search??new
bastien 07-13-03 17:29?
?Re: keywords, checkbox array search??new
bastien 07-15-03 10:37?
?Re: keywords, checkbox array search??new
Truly 07-16-03 20:20?
?Re: keywords, checkbox array search??new
bastien 07-17-03 06:44?
?Re: keywords, checkbox array search??new
Truly 07-20-03 13:57?
?Re: keywords, checkbox array search??new
bastien 07-21-03 17:41?
?Re: keywords, checkbox array search??new
Truly 08-21-03 08:21?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > missing the array element indices (the square brackets with > the vars inside (ie [0]([zero]),[$x],[$y],[$z]) in the area > where you are iterating thru the array...i have paced them > in...wish i could show 'em in some format like bold or > color...sorry > > > if ($num_ext==1){ > $ext_type="'".$_POST['extension'][0]."'"; > }elseif ($num_ext>1){ > for ($x=0;$x<$num_ext;$x++){ > if ($x==0){ > //first element so no comma separator needed > $ext_type.="'".$_POST['extension'][0]."'"; > }else{ > //add the comma separator > $ext_type.=",'".$_POST['extension'][$x]."'"; > print "$ext_type ext_type
"; > } //close if then > }//close for loop > }else{ > //no elements so set to "na" > $ext_type="na"; > } > print "$x x value
"; > print "$ext_type ext_type
"; > > $num_img=count($_POST['image_type']); > print "$num_img num_img
";//a test to try to identify > problem > if ($num_img==1){ > $img_type="'".$_POST['image_type'][0]."'"; > }elseif ($num_img>1){ > for ($y=0;$y<$num_img;$y++){ > if ($y==0){ > //first element so no comma separator needed > $img_type.="'".$_POST['image_type'][$y]."'"; > }else{ > //add the comma separator > $img_type.=",'".$_POST['image_type'][$y]."'"; > print "$img_type img_type
"; > } //close if then > }//close for loop > }else{ > //no elements so set to "na" > $img_type="na"; > } > print "$y y value
"; > print "$img_type img_type
"; > > > $num_sub=count($_POST['subject']); > print "$num_sub num_sub
"; > if ($num_sub==1){ > $sub_type="'".$_POST['subject'][0]."'"; > }elseif ($num_sub>1){ > for ($z=0;$z<$num_sub;$z++){ > if ($z==0){ > //first element so no comma separator needed > $sub_type.="'".$_POST['subject'][$z]."'"; > }else{ > //add the comma separator > $sub_type.=",'".$_POST['subject'][$z]."'"; > print "$sub_type sub_type
"; > } //close if then > }//close for loop > }else{ > //no elements so set to "na" > $sub_type="na"; > } > print "$z z value
"; > print "$sub_type sub_type
"; ">??

Provided By
Phorum