Help Me! Plz? Multidimensional Arrays to Email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Innervate
Forum Newbie
Posts: 11
Joined: Sun Feb 17, 2008 11:05 am

Re: Help Me! Plz? Multidimensional Arrays to Email

Post by Innervate »

i still need help if anyone wants to take a look at this,

thanks
dream2rule
Forum Contributor
Posts: 109
Joined: Wed Jun 13, 2007 5:07 am

Re: Help Me! Plz? Multidimensional Arrays to Email

Post by dream2rule »

Hi innervate,

i wanted to know where are you storing all the states info?

if its in a database then you can follow this code below..

You can first create a table called states and store all the States therein.

Code: Select all

 
//sql query to retrieve states from the db 
        
$sql_1 = "SELECT distinct(states) FROM states";
$rs_1 = mysql_query($sql_1);
 
//retrieving multiple checkboxes info 
 
$checked_states_list = "";
while($state_names = mysql_fetch_array($rs_1))
{
    $states_1 = $state_names[0];
    $selected_states = $_POST[$states_1];
    
        if($selected_states == "on")
        $checked_states_list = $checked_states_list .$states_1 .", "; //this would append all the checked States separated by a comma
}
 
Hopefully this piece of a simple code helps you.

Cheers,
Dream2rule
Post Reply