Hello:
I have a form where two fields are checkboxes. The field name identified in the form is interests[] and availability[].
After the form is submitted, I am storing the data into a table. When I look in my table, the results from the form which appear in the columns interests and availability shows the word "array". I know that the form fields are an array because a person is able to choose more than one.
First, did I insert the data correctly from the checkbox into the table?
Two, if I did, how do I retrieve the data from those fields so if someone wants to view the data in the table, the actual results will print not the word "array"?
Here is part of the code showing the form and the insert query. This is fairly a long script so I'm including the pieces of the code where I need help. If by chance the entire script needs to be posted, I will do so. Thank you for all the help.
** this is the form field Interests ***
<fieldset>
<legend>Interests</legend>
<p>Tell us in which areas you are interested in volunteering?<br></p>
<input type=checkbox name=interests[] value="Transportation"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Transportation', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Transportation<br>
<input type=checkbox name=interests[] value="Tutoring"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Tutoring', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Tutoring<br>
<input type=checkbox name=interests[] value="Mentoring"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Mentoring', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Mentoring<br>
<input type=checkbox name=interests[] value="Fundraising"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Fundraising', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Fundraising<br>
<input type=checkbox name=interests[] value="Activities"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Activties', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Activities<br>
<input type=checkbox name=interests[] value="Phone Bank"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Phone Bank', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Phone Bank<br>
<input type=checkbox name=interests[] value="Newsletter Production"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Newsletter', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Newsletter Production<br>
<input type=checkbox name=interests[] value="Volunteer Coordination"<?php echo ( isset ( $_SESSION['interests'] ) && in_array ( 'Volunteer Coordination', $_SESSION['interests'] ) ? ' checked="checked"' : '' ); ?> />Volunteer Coordination</p>
</fieldset>
** this is my insert query **
$query = "INSERT INTO app_vol (vol_lname, vol_fname, vol_address, vol_city, vol_state, vol_zip, vol_home_phone,
vol_work_phone, vol_email, availability, interests, special_skills, prev_exp, vol_em_name,
vol_em_address, vol_em_city, vol_em_state, vol_em_zip, vol_em_home_phone, vol_em_work_phone,
vol_em_email, date)
VALUES ('$_SESSION[vol_lname]', '$_SESSION[vol_fname]','$_SESSION[vol_address]','$_SESSION[vol_city]', '$_SESSION[vol_state]',
'$_SESSION[vol_zip]', '$_SESSION[vol_home_phone]', '$_SESSION[vol_work_phone]', '$_SESSION[vol_email]',
'$_SESSION[availability]', '$_SESSION[interests]', '$_SESSION[special_skills]', '$_SESSION[prev_exp]',
'$_SESSION[vol_em_name]', '$_SESSION[vol_em_address]','$_SESSION[vol_em_city]', '$_SESSION[vol_em_state]',
'$_SESSION[vol_em_zip]', '$_SESSION[vol_em_home_phone]', '$_SESSION[vol_em_work_phone]', '$_SESSION[vol_em_email]', CURRENT_DATE())";
$result = mysql_query ($query) or die (mysql_error());