Hi ND,
Yea, I slapped that together trying to show what I want. I will elaborate.
I have a function to make the cc checkboxes.
function makeCheckboxList($name,$list,$selected="") {
global $x;
while(list($value,$label) = each($list)) {
if($value['enabled']=='1') {
$options .= '<input name="'.$name.'" type="checkbox" value="'.$value.'" tabindex="'.$x.'" checked="checked" /> '.$label.'<br />';
} else {
$options .= '<input name="'.$name.'" type="checkbox" value="'.$value.'" tabindex="'.$x.'" /> '.$label.'<br />';
}
}
return $options;
}
And then I define it in my form.
$x='2'; //tabindex value
$list2 = makeCheckboxList('Contacts[]',$contactname2,$contactname2);
echo $list2;
And I have a drop down for the Director (person ordering the job) and I want to include this id for my email array (added to the Contacts array above).
function makeDropList($name,$list,$selected="") {
// $name select name
// $list array of value, label pair
// $selected selected value
global $x;
while(list($value,$label) = each($list)) {
$options .= '<option value="'.$value.'">'.$label.'</option>';
}
$dropList = '<select name="'.$name.'" tabindex="'.$x.'">'.$options.'</select>'."\n";
if($contactname == " ") {
$dropList = ereg_replace("value=\"$selected\"","value=\"$selected\" selected",$dropList);
}
return $dropList;
}
$x='1'; //tabindex value
$list = makeDropList('Director',$contactname,$contactname);
echo $list;
Then in my form, I was going to do foreach loop and go thru the names and send an email to each.
//Open SMTP port to send emails
$fp = fsockopen(localhost, 25, $errno, $errstr, 30);
foreach ($_POST['Contacts'] as $contact) {
$EmailAddress = $row['ea'];
$FirstName = $row['fn'];
$LastName = $row['ln'];
echo '-->'.$FirstName.' '.$LastName.' '.'at '.$EmailAddress.'<br><br>';
//Send email to them
$message = '<html><head></head><body><font size="2" face="Arial, Helvetica, sans-serif">This is to notify you that Job Order #'.$ID.' has been added/updated. Please check the status <a href="http://www.advisoryzone.org/staff/editjoborder.php?id='.$ID.'">here.</a></font></body></html>';
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header .= "From: example@example.com\r\n";
$subject = 'Job Order Notification - '.$displaydate;
$email_to = $EmailAddress;
mail($email_to, $subject ,$message ,$header) ;
}
fclose($fp); // close ftp port
This code will not work, but should help make it a little clearer where I am heading with this. Does that make a little more sense?
I am TOTALLY open to suggestions here, since 'I am but the student and you are the master', to use a known quote. 🙂
Thanks for the help,
Don