h3110w0r1d Posted February 5, 2011 Share Posted February 5, 2011 I guess I'll rephrase since my wording wasn't very clear. Why don't echo "<p>\n"; if (!empty($locations) && is_array($locations)) { foreach ($locations as $field => $val) { if ($field == "City") { echo $field . ' : ' . $val . "<br />\n"; $val = $cityvar; } if ($field == "ZipPostalCode") { echo $field . ' : ' . $val . "<br />\n"; $val = $zipvar; } if ($field == "CountryName") { echo $field . ' : ' . $val . "<br />\n"; $val = $countryvar; } } } echo "</p>\n"; Quote Link to comment Share on other sites More sharing options...
h3110w0r1d Posted February 5, 2011 Author Share Posted February 5, 2011 ... Why don't $cityvar, $zipvar, and $countryvar have values? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 5, 2011 Share Posted February 5, 2011 because you don't set them to anything? Quote Link to comment Share on other sites More sharing options...
h3110w0r1d Posted February 5, 2011 Author Share Posted February 5, 2011 How would that be done? I updated my original post to show what I've tried and doesn't work. Quote Link to comment Share on other sites More sharing options...
sunfighter Posted February 5, 2011 Share Posted February 5, 2011 First get rid of those \n why are they in a php/html file Next I have never heard of 'is_array ' that probibly your error maybe in_array Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 5, 2011 Share Posted February 5, 2011 to assign a value to a variable, put the variable on the left and the value you are trying to assign to it on the right. in the middle, there should be an equal sign. $cityvar = $val; Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 5, 2011 Share Posted February 5, 2011 First get rid of those \n why are they in a php/html file Next I have never heard of 'is_array ' that probibly your error maybe in_array \n is a line break. nothing wrong there. is_array is a function: http://php.net/manual/en/function.is-array.php Quote Link to comment Share on other sites More sharing options...
h3110w0r1d Posted February 5, 2011 Author Share Posted February 5, 2011 to assign a value to a variable, put the variable on the left and the value you are trying to assign to it on the right. in the middle, there should be an equal sign. $cityvar = $val; This. Thank you, maybe had a little too much to drink last night. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 5, 2011 Share Posted February 5, 2011 Or maybe not enough. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.