bradgrafelman;10984768 wrote:It means the argument you supplied to [man]foreach/man was invalid.
Since the manual states that foreach() expects an array as the only argument, that means you supplied foreach() with something other than an array.
Here is my code, can you help me correct the issue?
$partnerspresentation_array = $_POST['partnerspresentation'];
foreach ($partnerspresentation_array as $one_partnerspresentation) {
$sourcepresentation .= $one_partnerspresentation.",";
}
$partnerspresentation = substr($sourcepresentation, 0, -2);
$partnersorientation_array=$_POST['partnersorientation'];
foreach ($partnersorientation_array as $one_partnersorientation) {
$sourceorientation .= $one_partnersorientation.",";
}
$partnersorientation = substr($sourceorientation, 0, -2);
$partnersgender_array=$_POST['partnersgender'];
foreach ($partnersgender_array as $one_partnersgendername) {
$sourcegender .=$one_partnersgender.",";
}
$partnersgender =substr($sourcegender, 0, -2);
$partnersage_array=$_POST['partnersage'];
foreach ($partnersage_array as $one_partnersage) {
$sourceage .=$one_partnersage.",";
}
$partnersage =substr($souceage, 0, -2);
$partnersethnicity_array=$_POST['partnersethnicity'];
foreach ($partnersethnicity_array as $one_partnersethnicity) {
$sourceethnicity .=$one_partnersethnicity.",";
}
$partnersethnicity =substr($sourceethnicity, 0, -2);
$partneradjectives_array=$_POST['partneradjectives'];
foreach ($partneradjectives_array as $one_partneradjectives) {
$sourceadjective .=$one_partneradjectives.",";
}
$partneradjectives =substr($sourceadjectives, 0, -2);
$sqlClientInfo= "INSERT INTO `Client_Info` (Last_Name, First_Name, Middle_Name, Date_of_Birth, Street_Address, City, State, Zip_Code, Phone_Number, Email, Preferred_Contact, Gender, Sexual_Orientation, Race_Ethnicity,
Gender_Presentation, Body_Type, Height, Weight, Felony, Partners_Gender, Partners_Sexual_Orientation,
Partners_Race_Ethnicity, Partners_Gender_Presentation, Partners_Body_Type, Partners_Age, Partners_Height, Turn_On, Turn_Off, Celebrity_Crush, First_thing_you_notice, Deal_Breaker)
VALUES ('$_POST[lastname]','$_POST[firstname]','$_POST[middlename]','$_POST[birthdate]',
'$_POST[streetaddress]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone]',
'$_POST[email]','$_POST[contactmethod]','$_POST[yourgender]','$_POST[yourorientation]',
'$_POST[ethnicity]','$_POST[yourpresentation]','$_POST[bodytype]','$_POST[height]',
'$_POST[weight]','$_POST[felony]','$partnersgender','$partnersorientation',
'$partnerethnicity','$partnerspresentation','$partnerbodytype',
'$partnersage','$_POST[partnersheight]','$_POST[turnon]','$_POST[turnoff]',
'$_POST[celebritycrush]','$_POST[firstthing]','$_POST[dealbreaker]')";