OldWest Posted November 13, 2010 Share Posted November 13, 2010 I've got a few hours in this, read the manual on return (and it appears my print_r should be working!).. And I am unable to get print_r() to output the contents of my function array. What am I doing wrong? function getStateName() { $stateName = array("Alabama","Florida","Nevada"); return $stateName; } echo "<pre>"; echo print_r($stateName); echo "</pre>"; Quote Link to comment Share on other sites More sharing options...
Vitamin Posted November 13, 2010 Share Posted November 13, 2010 You have to call getStateName() first function getStateName() { $stateName = array("Alabama","Florida","Nevada"); return $stateName; } echo "<pre>"; $test = getStateName(); echo print_r($test); echo "</pre>"; Quote Link to comment Share on other sites More sharing options...
OldWest Posted November 13, 2010 Author Share Posted November 13, 2010 Vitamin, Thanks for confirming that .. I tried that earlier, and it was not working BUT I just found the problem was in my form.. I forgot to set the method to post, and I could not get anything to print to the screen with my submit button! I think its time for bed. 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.