Home  
  Your Account | View Cart        
  Help   
  0 item(s) in Cart        English  Italiano
 
  Home
 May 26, 2013
 Forum Board
 FAQs & Hints
Solutions
Ask for a quote
 Ask for a quote 
DREAMWEAVER DISCUSSION GROUP
old post - new thread - new reply Back to Board
27/05/12  01:35:03 Bobby Edgar
Implode/Explode Multi Menu
I've had this extension for many many years, and it worked well all those years ago. I am trying to use it again, but can't for the life of me get it to work.

I follow all instructions correctly:

Create the form.
Apply the Insert Record
Apply the MultiSelect Server Behavior (input the name of the select menu (without the []) and choose a coma as the deliminator)
Append [] to the select name.

When I submit the form, it's only inputting the first selection in the DB

I use Dreamweaver CS5.5 and my server runs PHP 5.3

Can someone PLEASE HELP ME?
  
28/05/12  01:10:37 Felice Di Stefano
RE: Implode/Explode Multi Menu
You must use the Implode Menu behavior and check that this block of code is placed before the Insert code.
Then you can use the Get Dynamic Multi Selection to retrieve it back.
  
28/05/12  01:57:33 Bobby Edgar
RE: RE: Implode/Explode Multi Menu
It is.

Here is the code block:

// *** Implode multiple selection
if (isset($_POST["sr_profile_areas"]) && is_array($_POST["sr_profile_areas"])) {
$_POST["sr_profile_areas"] = implode(" | ", $_POST["sr_profile_areas"]);
$HTTP_POST_VARS["sr_profile_areas"] = $_POST["sr_profile_areas"];
}
// FELIXONE � 2002/2004 SB by Felice Di Stefano - www.felixone.it

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if (!isset($mm_abort_edit) || !$mm_abort_edit) {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "new_reg")) {
$insertSQL = sprintf("INSERT INTO sr_users (usr_level, sr_profile_experience, sr_browse_experience, usr_id, sr_r, REMOTE_ADDR, HTTP_USER_AGENT, sr_usr_account_added, sr_company_name, sr_first_name, sr_last_name, sr_display_name, sr_email, sr_pw_temp, sr_zipcode, sr_phone, sr_city, sr_state, sr_country) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

Perhaps it's because $HTTP_POST_VARS is depreciated in PHP 5.3.

Any thought on how to re-code it to work in PHP 5.3?

Thanks for your help.
  
28/05/12  16:45:05 Bobby Edgar
RE: RE: RE: Implode/Explode Multi Menu
Here's a more thorough copy of the code including how I have the select forms setup. It's really strange because the extension worked great many years ago. I certainly appreciate all of your help.

<?php require_once('Connections/db_1.php'); ?>
<?php require_once('Connections/db_2.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

// *** Implode multiple selection
if (isset($_POST["sr_profile_areas"]) && is_array($_POST["sr_profile_areas"])) {
$_POST["sr_profile_areas"] = implode(" | ", $_POST["sr_profile_areas"]);
$HTTP_POST_VARS["sr_profile_areas"] = $_POST["sr_profile_areas"];
}
// FELIXONE � 2002/2004 SB by Felice Di Stefano - www.felixone.it

// *** Implode multiple selection
if (isset($_POST["sr_browse_areas"]) && is_array($_POST["sr_browse_areas"])) {
$_POST["sr_browse_areas"] = implode(" | ", $_POST["sr_browse_areas"]);
$HTTP_POST_VARS["sr_browse_areas"] = $_POST["sr_browse_areas"];
}
// FELIXONE � 2002/2004 SB by Felice Di Stefano - www.felixone.it

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if (!isset($mm_abort_edit) || !$mm_abort_edit) {
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "new_reg")) {
$insertSQL = sprintf("INSERT INTO sr_users (usr_level, sr_profile_experience, sr_browse_experience, usr_id, sr_r, REMOTE_ADDR, HTTP_USER_AGENT, sr_usr_account_added, sr_company_name, sr_first_name, sr_last_name, sr_display_name, sr_email, sr_pw_temp, sr_zipcode, sr_phone, sr_city, sr_state, sr_country) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['usr_level'], "text"),
GetSQLValueString($_POST['sr_profile_areas'], "text"),
GetSQLValueString($_POST['sr_browse_areas'], "text"),
GetSQLValueString($_POST['usr_id'], "text"),
GetSQLValueString($_POST['sr_r'], "text"),
GetSQLValueString($_POST['REMOTE_ADDR'], "text"),
GetSQLValueString($_POST['HTTP_USER_AGENT'], "text"),
GetSQLValueString($_POST['sr_usr_account_added'], "text"),
GetSQLValueString($_POST['sr_company_name'], "text"),
GetSQLValueString($_POST['sr_first_name'], "text"),
GetSQLValueString($_POST['sr_last_name'], "text"),
GetSQLValueString($_POST['sr_display_name'], "text"),
GetSQLValueString($_POST['sr_email'], "text"),
GetSQLValueString($_POST['sr_pw_temp'], "text"),
GetSQLValueString($_POST['sr_zipcode'], "text"),
GetSQLValueString($_POST['sr_phone'], "text"),
GetSQLValueString($_POST['sr_city'], "text"),
GetSQLValueString($_POST['sr_state'], "text"),
GetSQLValueString($_POST['sr_country'], "text"));

mysql_select_db($database_ae_users, $ae_users);
$Result1 = mysql_query($insertSQL, $ae_users) or die(mysql_error());
}}

Forms:

<select name="sr_profile_areas[]" size="3" multiple="multiple" class="file_forms">
<option value="N/A" selected="selected">All That Apply</option>
<option value="Performer">Performer</option>
<option value="Designer">Designer</option>
<option value="Technician">Technician</option>
<option value="Management">Management</option>
<option value="Musician">Musician</option>
<option value="Directing">Directing</option>
<option value="Artisan">Artisan</option>
</select>

<select name="sr_browse_areas[]" size="3" multiple="multiple" class="file_forms">
<option value="N/A" selected="selected">All That Apply</option>
<option value="Casting">Casting</option>
<option value="Agent">Agent</option>
<option value="Producer">Producer</option>
<option value="Hiring">Hiring</option>
</select>

  
02/07/12  17:06:39 Bobby Edgar
RE: RE: RE: RE: Implode/Explode Multi Menu
Can anyone PLEASE help with this issue? It's holding me up on my website design.
  


Powered by FELIXONE - v.n. 5718365 - FELIXONE.it © 2001 - 2013