Forum Moderators: coopster

Message Too Old, No Replies

Need help debugging script

         

jaybaker

5:52 am on Jan 2, 2009 (gmt 0)

10+ Year Member



Hello everyone. I am in process of creating a script that will add information to a pdf via the dynamic creation of an fdf file. Everything seems to be working except for the area on the form with the check boxes. In the form itself I have each checkboxes name set to concerns[]. Below is my code. I have success echoing the selected checkboxes but when it comes to assigning the values to an array to be added to the fdf file I have an issue. It only shows up as other being selected no matter if it is or not.
[codes]
$concerns=$_POST['concerns'];
foreach($concerns as $value){
$data['symptoms']=$value;
echo $data['symptoms'].'<br />';
}
[/codes]
The $data array is used to place the field names and their values in the proper areas for the fdf file. So why is it when I echo $value that things come out right but when I assign $value to the $data['symptoms'] that it only shows other no matter if anything else including other is selected? Your prompt help is greatly appreciated.

Jay

Mahabub

6:30 am on Jan 2, 2009 (gmt 0)

10+ Year Member



Dear jaybaker,

if $concerns is an array then $data['symptoms'] can hold only one value. Still I didnt understand your problem clearly I just guess what would be the problem... you may use the below one and try..

$data['symptoms'][]=$value;

Thanks
Mahabub

jaybaker

7:40 am on Jan 2, 2009 (gmt 0)

10+ Year Member



That was my problem. No matter which checkboxes I checked it only showed the last option which was other. So when I added that simple set of brackets the[] after $data['symptoms'] it worked! I could get any mixture of the values! THANKS!

jaybaker

8:36 am on Jan 2, 2009 (gmt 0)

10+ Year Member



Now if you can email me because I have something else that is stumping me. I have the form that is filled out online and creates an fdf document linked with a pdf in the same directory. Idealy the fdf is supposed to automatically fill in the form thats in the pdf. It is not and of course we need it to. Email me and I will send you the zip file of everything I have.