Hi All,
I'm having some trouble creating variables from information pulled from records in the User Account table.
I'm using that information to choose which user's email address is to be used to send emails to various board members and committee chairs.
The visitor can then send the output of the form to the appropriate email address by selecting an option from a pull down field
So Far...
As a test, I’ve been able to get the form working by creating a series of variables for the various board positions in a single record editor.
Like this:
<?php
$president = $board_of_directors_informationRecord['president_email'];
$vice_president = $board_of_directors_informationRecord['vice_president_email'];
$secretary = $board_of_directors_informationRecord['secretary_email'];
$treasurer = $board_of_directors_informationRecord['treasurer_email'];
?>
and then using if statements that match the $reason field options in the mail form with the variable values to sort them out.
Like This:
if ($FTGreason == "President") {
$emailTo = $president;
if ($FTGreason == "Secretary") {
$emailTo = $secretary;
etc.
My goal
My goal is to be able to assign the email recipient from a combination of a pull down:
(board_of_director_position_1, board_of_director_position_2, board_of_director_position_3)
and check box
(board_of_director_position_1_email , board_of_director_position_2_email, board_of_director_position_3_email)
in the member’s user record, and I’m up to the last step
I was able to generate a list of positions and email addresses that match the format of the above variables.
Like This:
<?php foreach ($directorposition as $positiona): ?>
<?php foreach ($accountsRecords as $record): ?>
<?php if ($record['board_of_director_position_1:label'] == $positiona || $record['board_of_director_position_2:label'] == $positiona || $record['board_of_director_position_3:label'] == $positiona) : // is there a position selected ?>
<?php $positionc = strtolower($positiona) ; // format the position ?>
<?PHP $positionc = preg_replace('/\s+/', '_', $positionc ); ?>
<?PHP $positionc = preg_replace('/-/', '_', $positionc ); ?>
<?php if ($record['board_of_director_position_1:label'] == $positiona && $positiona && $record['board_of_director_position_1_email'] == '1'): // is this records email address the one to use ?>
<?php $positionb = $record['email'] ?>
<?php endif ?>
<?php if ($record['board_of_director_position_2:label'] == $positiona && $positiona && $record['board_of_director_position_2_email'] == '1'): ?>
<?php $positionb = $record['email']?>
<?php endif ?>
<?php if ($record['board_of_director_position_3:label'] == $positiona && $positiona && $record['board_of_director_position_3_email'] == '1'): ?>
<?php $positionb = $record['email']?>
<?php endif ?>
<?php '$'; ?><?php $positionc ?> <?php '='; ?> <?php $positionb ?><?php '; ' // This is the code that is supposed to create the variables ?>;
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>
I’m having no luck converting that output into actual variables, and hope that someone has an idea or two.
The output I’m looking for is a series of variables like:
$president = thepresidentsemailaddress@comcast.net;
$vice_president = thevicepresidentsemail address@gmail.com;
$secretary = thescrretarysemail@hotmail.com;
etc.
I’ve attached the code I have so far. (line 44 is supposed to create the variables and lines 479, 493 etc. are supposed to use them)
Thanks for looking,
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php