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

Dynamic dropdown insert to database

Thread began 6/29/2020 11:53 am by Jonas | Last modified 7/01/2020 1:38 pm by Ray Borduin | 77 views | 19 replies |

Jonas

Dynamic dropdown insert to database

I've done the Dynamic Dropdowns tutorial with Data Bridge 2.0 (http://www.webassist.com/tutorials/Dynamic-Dropdowns-with-Data-Bridge-2-0#last_comment). The question that unfortunately is not explained - is how to save the selections from both select-lists, to another table?

If I want both Towns and Teams selections to be saved in a new table - how to do this?
Since, among other things, there is already a form on the page that processes the choice from Town, you can't create a submit button, or am I thinking wrong?

I would rather see this explained in the same tutorial - as it should be of general interest.

Sign in to reply to this post

Ray BorduinWebAssist

As long as the select lists are inside the same <form> tag, they will both be submitted with the form and can be used for insert just like any other form element.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Okay! But how do I do with the ID question? I want to save the respective value from ID, not TownName and teamName. How do I change the select-list options?

Sign in to reply to this post

Ray BorduinWebAssist

You should be able to set the value of the select list options to the ID and use that for the insert. I'm afraid I might be missing the question, but whatever you want saved to the database should be the value of the select list.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

I don't understand how to change the querys, and how to change select-lists to display id instead. According to the tutorial, both value and label = teamName, on the childSelect page and townName on the main page. Value should be ID instead I think. But this does not work. Then childSelect will not be displayed. Please explain how this will work. Both childSelect page and main.

Sign in to reply to this post

Ray BorduinWebAssist

The select value should be the ID and then the recordset on the child list plugin should filter based on the ID.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

On which page should select value be ID, both pages?
What should the recordset on the child list look like?
Here's how it is now:
<?php
$rsTeams = new WA_MySQLi_RS("rsTeams",$dynamicDropdown,0);
$rsTeams->setQuery("SELECT * FROM teams WHERE teamTown = ? ORDER BY teamName ASC");
$rsTeams->bindParam("s", "".(isset($_POST['towns'])?$_POST['towns']:"") ."", "-1"); //colname
$rsTeams->execute();
?>
Thanks in advance!

Sign in to reply to this post

Ray BorduinWebAssist

The select lists value should be what you want inserted to the database for both lists.

Just change the column in the WHERE clause to match the value from the select list submitted.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

I have tried the following, but the contents of child select list are not displayed.

Sign in to reply to this post

Ray BorduinWebAssist

The child select should be:

SELECT * FROM teams WHERE town_id = ?

not

SELECT * FROM teams WHERE teams_id = ?

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

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...