Hello, I am wondering if someone can give some help on using two arrays to build a drop down, and save the values for each of them when needed without
the constants colliding. Here is some information about the arrays used and the current foreach I use to build it.
$share_types = array(
SHARE_TYPE_AGENT => “Agent Software”,
SHARE_TYPE_FS => “File Share”,
SHARE_TYPE_EMAIL_EXCHANGE => “Message-Level Backup (Exchange)”,
SHARE_TYPE_EMAIL_GROUPWISE => “Message-Level Backup (GroupWise)”,
SHARE_TYPE_VMWARE => “VMware”
);
$share_protocols = array(
SHARE_FS_PROTOCOL_CIFS => “File Share (CIFS)”,
SHARE_FS_PROTOCOL_SSHFS => “File Share (SSHFS)”,
SHARE_FS_PROTOCOL_NCPFS => “File Share (NCPFS)”
);
Here is the current foreach loop that will build the drop down. It is basically taking the share_type array and foreaching through it. (The few if
statements in there are just hiding a few of the choices if certain circumstances are met)
// block out anything except agent shares when asked
if ( $lock_to_share_type_agent )
{
$html .= ‘<option value=”‘. SHARE_TYPE_AGENT .'” selected=”selected”>’. $share_types[SHARE_TYPE_AGENT] .'</option>’;
include_once(BASE_PATH .’/web/customer/lib/share/read.php’);
foreach( $share_types as $key => $value )
{
// don’t show File Share type if network_fs_enabled is 0
if ( $key == SHARE_TYPE_FS && $server_info[‘network_fs_enabled’] == 0 && $server_info[‘server_type’] == SERVER_TYPE_OSB_WINDOWS ) continue;
// make sure account has access to agent services and that the server has agent support turned on
if ( $key == SHARE_TYPE_AGENT && (!$agent_service_available || !$server_agent_enabled) ) continue;
$selected = ( _fd(“type”, $field_data) == $key ) ? ” selected=”selected”” : “”;
$html .= “<option value=”{$key}”{$selected}>{$value}</option>”;
}
}
Now what I want to do now is incorporate another array ($share_protocols) as seen above to display next to the file share if that is picked. I have tried doing
something like seen below, but the constant values seem to be colliding. The problem is I need to save the constant value from the first array ($share_type),
and also the constant value from the 2nd array if we are using it ($share_protocol) In a perfect world the drop down would be:
File Share – CIFS
File Share – SSHFS
File Share – NCPFS
then the rest…
Saving both the share type (File Share) and the share protocol (CIFS, or SSHFS, or NCPFS) depending on what is selected.
If anyone has any input I would greatly appreciate it. It is a bit hard to explain what I am trying to do so I apologize if it is confusing/overwheling.
Thanks.