close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Drop down lists / menus

Thread began 5/10/2012 11:03 am by h150477 | Last modified 5/15/2012 12:42 pm by h150477 | 911 views | 4 replies |

h150477

Drop down lists / menus

I set up my preset to produce a select list (1 column tall) that connects to a recordset for some of the fields. It did not work as no list was produced by the wizard.
An input for a list was shown in the code, so I populated it with the data from the recordset, so that the list worked, and when I ran the code, all that appeared for that field in the database was the word Array - not the field value from the array.

I then bound the field in the insert record server behaviour to the recordset field and thought that the problem was solved. However, on closer inspection, no matter what selection I make, the first item in the list is always stored in the database.
The name always appears in the code like Registration_group_fieldname[]

Does this need changing, or is there another reason for the problem?

Sign in to reply to this post

Jason ByrnesWebAssist

this is a problem with using multiple select lists.

Multiple select lists pass the selections as an array, the array needs to be converted to a comma separated list.


add the following code at line 1 of your page to convert the array:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

h150477

This post has been deleted.

h150477

Wherever I put this code it generates a headers already sent error message.

I changed my fields from lists to menus and it works in that it now stores the selected items in the database.

However, I do need need to store three fields from one of the recordsets associated with a list, one being the selected field, and the other two being fields in the the same record.

I created two hidden fields and set their values to that stored in the selected recordset. (at least I think that I have) using the following code for one of them:

<input name="country" type="hidden" id="country" value="<?php echo $row_clubset['country_id']; ?>">

They both save the info from the default value of the recordset, and not that stored in the current recordset after it has been selected.

How do I get them to save the current recordset data?

Sign in to reply to this post

Jason ByrnesWebAssist

the headers already sent error happens if there is space between php code blocks:
showthread.php?t=19285


you are probably copying a blank space.


  However, I do need need to store three fields from one of the recordsets associated with a list, one being the selected field, and the other two being fields in the the same record.  




this is a bad way to set up your database and will lead to problems with data normalization.

the problem with doing this is that the same data is stored over and over in multiple places, what happens if a change to one of those fields need to be made?

instead of storing the related data in the table, the select list should store the ID of the record, then you can use a join query to retrieve the related data at run time.

Sign in to reply to this post

h150477

Correct in both cases. Thanks.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...