> Parse error: parse error, expecting `']'' in file.php
>
> I've been working on this script, and can't see why it fails here, but I
> have
> another page that uses the same coding and it works correctly.
>
> OK, here's the code:
> $cart1 = "";
> $cart1 =
> "'$_POST[nutrition_program_assistant]','$_POST[County]','$_POST[ERS_entry_date]','$_POST[ERS_exit_date]','$_POST[Group_ID]','$_POST[wname_of_group]','$_POST[select]','$_POST[Contact_person]','$_POST[Telephone]','$_POST[Group_Address]','$_POST[city]','$_POST[zip]','$_POST[Volunteer_1]','$_POST[Volunteer_2]','$_POST[Volunteer_3]','$_POST[Volunteer_4]','$_POST[Program_start_date]','$_POST[Projected_end_date]','$_POST[Actual_end_date]','$_POST[Eval_Pre_test]','$_POST[Eval_post_test]','$_POST[number_meetings]','$_POST[number_contact_hours]','$_POST[wname_1]','$_POST[sex_1]','$_POST[race_1]','$_POST[res_1]','$_POST[bday_mo_1]','$_POST[bday_day_1]','$_POST[bday_yr_1]','$_POST[grade_1]','$_POST[4_h_1]','$_POST[wname_2]','$_POST[sex_2]','$_POST[race_2]','$_POST[res_2]','$_POST[bday_mo_2]','$_POST[bday_day_2]','$_POST[bday_yr_2]','$_POST[grade_2]','$_POST[4_h_2]','$_POST[wname_3]','$_POST[sex_3]','$_POST[race_3]','$_POST[res_3]','$_POST[bday_mo_3]','$_POST[bday_day_3]','$_POST[bday_yr
> _3]','$_POST[grade_3]','$_POST[4_h_3]','$_POST[wname_4]','$_POST[sex_4]','$_POST[race_4]','$_POST[res_4]','$_POST[bday_mo_4]','$_POST[bday_day_4]','$_POST[bday_yr_4]','$_POST[grade_4]','$_POST[4_h_4]','$_POST[wname_5]','$_POST[sex_5]','$_POST[race_5]','$_POST[res_5]','$_POST[bday_mo_5]','$_POST[bday_day_5]','$_POST[bday_yr_5]','$_POST[grade_5]','$_POST[4_h_5]','$_POST[wname_6]','$_POST[sex_6]','$_POST[race_6]','$_POST[res_6]','$_POST[bday_mo_6]','$_POST[bday_day_6]','$_POST[bday_yr_6]'";
> $cart2 = "";
> $cart2 =
> "'$_POST[grade_6]','$_POST[4_h_6]','$_POST[wname_7]','$_POST[sex_7]','$_POST[race_7]','$_POST[res_7]','$_POST[bday_mo_7]','$_POST[bday_day_7]','$_POST[bday_yr_7]','$_POST[grade_7]','$_POST[4_h_7]','$_POST[wname_8]','$_POST[sex_8]','$_POST[race_8]','$_POST[res_8]','$_POST[bday_mo_8]','$_POST[bday_day_8]','$_POST[bday_yr_8]','$_POST[grade_8]','$_POST[4_h_8]','$_POST[wname_9]','$_POST[sex_9]','$_POST[race_9]','$_POST[res_9]','$_POST[bday_mo_9]','$_POST[bday_day_9]','$_POST[bday_yr_9]','$_POST[grade_9]','$_POST[4_h_9]','$_POST[wname_10]','$_POST[sex_10]','$_POST[race_10]','$_POST[res_10]','$_POST[bday_mo_10]','$_POST[bday_day_10]','$_POST[bday_yr_10]','$_POST[grade_10]','$_POST[4_h_10]','$_POST[Attend_1_1]','$_POST[Attend_2_1]','$_POST[Attend_3_1]','$_POST[Attend_4_1]','$_POST[Attend_5_1]','$_POST[Attend_6_1]','$_POST[Attend_7_1]','$_POST[Attend_8_1]','$_POST[Attend_9_1]','$_POST[Attend_10_1]','$_POST[Attend_1_2]','$_POST[Attend_2_2]','$_POST[Attend_3_2]','$_POST[Attend_4_2]','$
> _POST[Attend_5_2]','$_POST[Attend_6_2]','$_POST[Attend_7_2]','$_POST[Attend_8_2]','$_POST[Attend_9_2]','$_POST[Attend_10_2]','$_POST[Attend_1_3]','$_POST[Attend_2_3]','$_POST[Attend_3_3]','$_POST[Attend_4_3]','$_POST[Attend_5_3]','$_POST[Attend_6_3]','$_POST[Attend_7_3]','$_POST[Attend_8_3]','$_POST[Attend_9_3]','$_POST[Attend_10_3]','$_POST[Attend_1_4]','$_POST[Attend_2_4]','$_POST[Attend_3_4]','$_POST[Attend_4_4]','$_POST[Attend_5_4]','$_POST[Attend_6_4]','$_POST[Attend_7_4]','$_POST[Attend_8_4]','$_POST[Attend_9_4]','$_POST[Attend_10_4]','$_POST[Attend_1_5]','$_POST[Attend_2_5]','$_POST[Attend_3_5]','$_POST[Attend_4_5]','$_POST[Attend_5_5]','$_POST[Attend_6_5]','$_POST[Attend_7_5]','$_POST[Attend_8_5]','$_POST[Attend_9_5]','$_POST[Attend_10_5]','$_POST[Attend_1_6]','$_POST[Attend_2_6]','$_POST[Attend_3_6]','$_POST[Attend_4_6]','$_POST[Attend_5_6]','$_POST[Attend_6_6]','$_POST[Attend_7_6]','$_POST[Attend_8_6]','$_POST[Attend_9_6]','$_POST[Attend_10_6]','$_POST[Attend_1_7]',
> '$_POST[Attend_2_7]','$_POST[Attend_3_7]','$_POST[Attend_4_7]','$_POST[Attend_5_7]','$_POST[Attend_6_7]','$_POST[Attend_7_7]','$_POST[Attend_8_7]','$_POST[Attend_9_7]','$_POST[Attend_10_7]','$_POST[Attend_1_8]','$_POST[Attend_2_8]','$_POST[Attend_3_8]','$_POST[Attend_4_8]','$_POST[Attend_5_8]','$_POST[Attend_6_8]','$_POST[Attend_7_8]','$_POST[Attend_8_8]','$_POST[Attend_9_8]','$_POST[Attend_10_8]','$_POST[Attend_1_9]','$_POST[Attend_2_9]','$_POST[Attend_3_9]','$_POST[Attend_4_9]','$_POST[Attend_5_9]','$_POST[Attend_6_9]','$_POST[Attend_7_9]','$_POST[Attend_8_9]','$_POST[Attend_9_9]','$_POST[Attend_10_9]','$_POST[Attend_1_10]','$_POST[Attend_2_10]','$_POST[Attend_3_10]','$_POST[Attend_4_10]','$_POST[Attend_5_10]','$_POST[Attend_6_10]','$_POST[Attend_7_10]','$_POST[Attend_8_10]','$_POST[Attend_9_10]','$_POST[Attend_10_10]','$_POST[TE_CT_1]','$_POST[TE_CTL_1]','$_POST[TE_CT_2]','$_POST[TE_CTL_2]','$_POST[TE_CT_3]','$_POST[TE_CTL_3]','$_POST[TE_D_1]','$_POST[TE_LT_1]','$_POST[TE_
> A_1]','$_POST[TE_FA_1]','$_POST[TE_H_1]'";
> $cart3 = "";
> $cart3 =
> "'$_POST[TE_D_2]','$_POST[TE_LT_2]','$_POST[TE_A_2]','$_POST[TE_FA_2]','$_POST[TE_H_2]','$_POST[TE_D_3]','$_POST[TE_LT_3]','$_POST[TE_A_3]','$_POST[TE_FA_3]','$_POST[TE_H_3]','$_POST[TE_D_4]','$_POST[TE_LT_4]','$_POST[TE_A_4]','$_POST[TE_FA_4]','$_POST[TE_H_4]','$_POST[TE_D_5]','$_POST[TE_LT_5]','$_POST[TE_A_5]','$_POST[TE_FA_5]','$_POST[TE_H_5]','$_POST[TE_D_6]','$_POST[TE_LT_6]','$_POST[TE_A_6]','$_POST[TE_FA_6]','$_POST[TE_H_6]','$_POST[TE_D_7]','$_POST[TE_LT_7]','$_POST[TE_A_7]','$_POST[TE_FA_7]','$_POST[TE_H_7]','$_POST[TE_D_8]','$_POST[TE_LT_8]','$_POST[TE_A_8]','$_POST[TE_FA_8]','$_POST[TE_H_8]','$_POST[TE_D_9]','$_POST[TE_LT_9]','$_POST[TE_A_9]','$_POST[TE_FA_9]','$_POST[TE_H_9]','$_POST[TE_D_10]','$_POST[TE_LT_10]','$_POST[TE_A_10]','$_POST[TE_FA_10]','$_POST[TE_H_10]','$_POST[TE_C]'";
>
> $addtocart = "insert into efnep_form
> values('',".$cart1.",".$cart2.",".$cart3.")";
> echo $addtocart;
>
>
> And the error I get is showing up on the $cart1 = "' line of code
>

There are two types of array keys: integers and strings.

When using the integer key, all you simply need to provide is the integer
like so:

$ARR[0], $ARR[1], $anotherArr[1], etc

When using the string key, you need to provide quotes around the string
like so:

$ARR['state'] or $ARR["state"]
$ARR['city'] or $ARR["city"]

I usually prefer the string type as it tells me exactly what that value
may be. Which of these arrays contains a city name value? $ARR[0], $ARR[5]
or $ARR['cityName']?

So when using arrays with string keys within strings you need to
concatenate it.

$var = "I live in the city of ". $_POST['cityname'];

Anyways, read up on it.
http://us2.php.net/manual/en/language.types.array.php
http://www.php.net/manual/en/language.operators.string.php

-- 
--Matthew Sims
--<http://killermookie.org>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to