<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C35D7F.E00F3A70">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:536871559 0 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
span.EmailStyle17
{mso-style-type:personal-compose;
mso-style-noshow:yes;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:Arial;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:windowtext;}
span.SpellE
{mso-style-name:"";
mso-spl-e:yes;}
span.GramE
{mso-style-name:"";
mso-gram-e:yes;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:382410087;
mso-list-type:hybrid;
mso-list-template-ids:966711186 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-tab-stop:1.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-tab-stop:1.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level4
{mso-level-tab-stop:2.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-tab-stop:2.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-tab-stop:3.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level7
{mso-level-tab-stop:3.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-tab-stop:4.0in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-tab-stop:4.5in;
mso-level-number-position:left;
text-indent:-.25in;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I can’t quite figure out how to insert selected values
from a drop down box (multiple <span class=GramE>list</span>) into <span
class=SpellE>mysql</span>. I have been able to successfully display the records
I want, but when I submit the form only a 0 value is inserted into my db. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Here’s the scenario:<o:p></o:p></span></font></p>
<ol style='mso-margin-top-alt:0in' start=1 type=1>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I have
2 tables – <span class=SpellE>t_org</span> and <span class=SpellE>t_state</span>
linked by a <span class=SpellE>stateID</span> field (<span class=SpellE>t_state</span>
would be the parent).</span></font> <font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></li>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I have
a <span class=SpellE>t_org</span> update form which contains, among other
fields, a multiple list drop down that is supposed display state names
from the <span class=SpellE>t_state</span> table. <o:p></o:p></span></font></li>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I
created a ZSQL method to basically pull the list with the following SQL:-</span></font>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></li>
</ol>
<p class=MsoNormal style='margin-left:.25in'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=2 color=red
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:red;
font-weight:bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:
normal'><span
style='mso-spacerun:yes'>
</span><span class=GramE>select</span> <span class=SpellE>state_name</span>, <span
class=SpellE>state_id</span> as <span class=SpellE>FK_state_id</span> from
state<o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=2 color=red
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:red;
font-weight:bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:
normal'><o:p> </o:p></span></font></i></b></p>
<ol style='mso-margin-top-alt:0in' start=4 type=1>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>In my <span
class=SpellE>t_org</span> update form I included the following snippet to
display the state names in a multiple selection drop down box (and it
works!):- <o:p></o:p></span></font></li>
</ol>
<p class=MsoNormal style='margin-left:.25in;text-indent:.25in'><b
style='mso-bidi-font-weight:normal'><i style='mso-bidi-font-style:normal'><font
size=3 color=red face="Times New Roman"><span style='font-size:12.0pt;
color:red;font-weight:bold;mso-bidi-font-weight:normal;font-style:italic;
mso-bidi-font-style:normal'><select NAME=<span class=SpellE><span
class=GramE>state_id</span></span><span class=GramE> :list</span> multiple><o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=3 color=red
face="Times New Roman"><span style='font-size:12.0pt;color:red;font-weight:
bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>
</span><option value=-1> <span class=GramE>None</span><o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=3 color=red
face="Times New Roman"><span style='font-size:12.0pt;color:red;font-weight:
bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>
</span><<span class=SpellE><span class=GramE>dtml</span></span><span
class=GramE>-in</span> <span class=SpellE>ddState</span>><o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=3 color=red
face="Times New Roman"><span style='font-size:12.0pt;color:red;font-weight:
bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>
</span><option value="<<span class=SpellE>dtml-var</span> <span
class=SpellE>FK_state_id</span>>"> <<span class=SpellE>dtml-var</span>
<span class=SpellE>state_name</span>><o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=3 color=red
face="Times New Roman"><span style='font-size:12.0pt;color:red;font-weight:
bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'>
</span></<span class=SpellE>dtml</span>-in><o:p></o:p></span></font></i></b></p>
<p class=MsoNormal style='margin-left:.25in'><b style='mso-bidi-font-weight:
normal'><i style='mso-bidi-font-style:normal'><font size=3 color=red
face="Times New Roman"><span style='font-size:12.0pt;color:red;font-weight:
bold;mso-bidi-font-weight:normal;font-style:italic;mso-bidi-font-style:normal'><span
style='mso-spacerun:yes'> </span></select><o:p></o:p></span></font></i></b></p>
<ol style='mso-margin-top-alt:0in' start=5 type=1>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>My org insert
method includes the following line to insert the selections made above:- <o:p></o:p></span></font></li>
</ol>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><<span class=SpellE>dtml-sqlvar</span> "','+_.<span
class=SpellE><span class=GramE>string.join</span></span><span class=GramE>(</span><span
class=SpellE>state_id</span>,',')+','" type=string> ,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<ol style='mso-margin-top-alt:0in' start=6 type=1>
<li class=MsoNormal style='mso-list:l0 level1 lfo1;tab-stops:list .5in'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>The problem
(which you may have already figured out, is that I cannot insert any of
the selected <span class=SpellE>state_id</span> values into the <span
class=SpellE>t_org</span> table! I am guessing there’s something
wrong with my insert syntax…Can you please help? <o:p></o:p></span></font></li>
</ol>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><span class=GramE><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>rex</span></font></span>
nedoli<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.25in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.25in'><span class=GramE><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>vital</span></font></span>
stats:<span style='mso-spacerun:yes'> </span><span class=SpellE>winXP</span>,
<font size=2 color="#333333" face=Verdana><span style='font-size:10.0pt;
font-family:Verdana;color:#333333'>Zope 2.6.1, python 2.1</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>