PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
city state zip in one array not working - need some help

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML
View previous topic :: View next topic  
Author Message
ryno



Joined: 14 Mar 2008
Posts: 2

PostPosted: Fri Mar 14, 2008 2:31 am    Post subject: city state zip in one array not working - need some help Reply with quote

I hate having really long forms and new lines for something so small as a zip box... so I'm grouping the City State and Zip together but I'm having problems calling the data out for my mailer.

Default form attributes
Code:
// Default form attributes
   $attsInput = array('size' => 40, 'maxlength' => 40);
   $attsInputShorty = array('size' => 15);
   $attsTextArea = array('rows' => 3, 'cols' => 30);
   $statesList = array("" => "", "AL" => "Alabama", "AK" => "Alaska", "AR" => "Arkansas", "AZ" => "Arizona", "CA" => "California", "CO" => "Colorado", "CT" => "Connecticut", "DE" => "Delaware", "DC" => "Dist of Columbia", "FL" => "Florida", "GA" => "Georgia", "HI" => "Hawaii", "ID" => "Idaho", "IL" => "Illinois", "IN" => "Indiana", "IA" => "Iowa", "KS" => "Kansas", "KY" => "Kentucky", "LA" => "Louisiana", "ME" => "Maine", "MD" => "Maryland", "MA" => "Massachusetts", "MI" => "Michigan", "MN" => "Minnesota", "MS" => "Mississippi", "MO" => "Missouri", "MT" => "Montana", "NE" => "Nebraska", "NV" => "Nevada", "NH" => "New Hampshire", "NJ" => "New Jersey", "NM" => "New Mexico", "NY" => "New York", "NC" => "North Carolina", "ND" => "North Dakota", "OH" => "Ohio", "OK" => "Oklahoma", "OR" => "Oregon", "PA" => "Pennsylvania", "RI" => "Rhode Island", "SC" => "South Carolina", "SD" => "South Dakota", "TN" => "Tennessee", "TX" => "Texas", "UT" => "Utah", "VT" => "Vermont", "VA" => "Virginia", "WA" => "Washington", "WV" => "West Virginia", "WI" => "Wisconsin", "WY" => "Wyoming");


Then displayed here:
Code:
   $eleCityStateZip[] = &HTML_QuickForm::createElement('text','txtCity','City',$attsInputShorty);
   $eleCityStateZip[] = &HTML_QuickForm::createElement('select','selState','State',$statesList);
   $eleCityStateZip[] = &HTML_QuickForm::createElement('text','txtZip','Zip','size="5" maxlength="5"');
$frmSellRV->addGroup($eleCityStateZip,'txtCityStateZip', 'City, State, Zip:');



Then trying to display in email here:
Code:

<p>' . $varForm['txtAddress'] . '<br>
            ' . $array_values['txtCity'] . ', ' . $array_values['selState'] . ' ' . $array_values['txtZip'] . '</p>


It seems to show the City and Zip fine but I'm losing the state array in there, and I'm thinking it's because of the array within an array.

My email I get has the following in it (notice no state)
Code:

1433 Ash St
Phoenix, 12345


Help please - need to wrap this project up.. Thanks much in advance![/code]
Back to top
View user's profile Send private message
ryno



Joined: 14 Mar 2008
Posts: 2

PostPosted: Fri Mar 14, 2008 3:05 am    Post subject: Reply with quote

you know I got a friend to help and he figure it out..... Eyes just buggin out so much over this and other code all day.

Solution....

I have $array_values (which I forgot to post below) and there was a problem with txtState being called and selState being the variable pulled... so it didn't match up....

Here's that array break down... (new one)
Code:
// Clean up the array for database by getSubmitValues into varForm
   $array_values = array(
      'txtCity'       => $varForm['txtCityStateZip']['txtCity'],
      'selState'       => $varForm['txtCityStateZip']['selState'],
      'txtZip'       => $varForm['txtCityStateZip']['txtZip']
   );


So I have all selState working now instead of having txtState in the above array...

Thanks for letting me post it anyways - maybe somebody can learn from the code then.. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software