Jump to content

associative array problem


bradkenyon

Recommended Posts

I need to use an associative array to pass flabels array thru it, to appear as checkboxes within a template.

 

  /*

  if (defined("ACCT_XFIELD1")) $f->add_element(array("type"=>"checkbox",

                            "name"=>"D_xfield1",

                            "multiple"=>1));

  */

 

//as you'll see below.

 

It won't display within the page when you call the page within a web browser.

 

What am I doing wrong?

 

This is the code on the page

 

function Create_Account_Register_Form ($fid='')
{

   $flabels = array (
        'Childrens Area',
        'Retail Sales',
        'Info Booth',
        'Beer/Wine Pouring',
        'Ticket Takers',
        'Hospitality',
        'Setup',
        'Marketing',
        'Stages',
        'Take down',
        'Security',
        'Cleanup',
        'Cashier',
        'Volunteer Check-In',
        'Volunteer Booth',
        'Artist Merchandise',
        'GAIF Food Booth',
        'EMS'
    );
    
    foreach ($flabels as $value) {
    
    	//printf('<input type="checkbox" name="D_xfield1[]" value="%s" /> %s<br />',$value,$value);
    	$interests[] = sprintf('<input type="checkbox" name="D_x_field1[]" value="%s" /> %s<br />',$value,$value);
    }
   

   $f = new form;

   if (defined("ACCT_USERNAME")) $f->ae(DF_username($_POST['D_username']));
   if (defined("ACCT_PASSWORD")) $f->ae(DF_password($_POST['D_password']));

   if (defined("ACCT_FIRSTNAME")) $f->ae(DF_firstname($_POST['D_firstname']));
   if (defined("ACCT_LASTNAME")) $f->ae(DF_lastname($_POST['D_lastname']));
   if (defined("ACCT_TITLE")) $f->ae(DF_title($_POST['D_title']));
   if (defined("ACCT_ORGANIZATION")) $f->ae(DF_organization($_POST['D_organization']));
   if (defined("ACCT_ADDRESS1")) $f->ae(DF_address1($_POST['D_address1']));
   if (defined("ACCT_ADDRESS2")) $f->ae(DF_address2($_POST['D_address2']));
   if (defined("ACCT_CITY")) $f->ae(DF_city($_POST['D_city']));
   if (defined("ACCT_STATEPROV")) $f->ae(DF_stateprov($_POST['D_stateprov']));
   if (defined("ACCT_COUNTRY")) $f->ae(DF_country($_POST['D_country']));
   if (defined("ACCT_POSTCODE")) $f->ae(DF_postalcode($_POST['D_postcode']));
   if (defined("ACCT_TELEPHONE")) $f->ae(DF_telephone($_POST['D_telephone']));
   if (defined("ACCT_FAX")) $f->ae(DF_fax($_POST['D_fax']));
   if (defined("ACCT_EMAIL")) $f->ae(DF_email($_POST['D_email']));
   
   /*
   if (defined("ACCT_XFIELD1")) $f->add_element(array("type"=>"checkbox",
                             "name"=>"D_xfield1",
                             "multiple"=>1));
   */ 
   
  $f->ae(array("type"=>"hidden", "name"=>"D_fid", "value"=>$fid));

   $f->ae(DF_submit('D_submit','REGISTER'));

   return $f;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/39357-associative-array-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.