Inserting data from combo box
Hi all.
I have a problem and I hope someone can help.
I have two tables
CREATE TABLE manager(
managerID INTEGER NOT NULL, (PK)
groupID INTEGER NOT NULL,
mname VARCHAR2(20),
msurname VARCHAR2(20)NOT NULL,
memail VARCHAR2(50)NOT NULL,
mpassword VARCHAR2(50)NOT NULL);
CREATE TABLE groups(
groupID INTEGER NOT NULL,(PK)
gtype CHAR(15) NOT NULL);
(xstl File linking to xsql file)
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:include href="../-xslt/top_links.xsl" />
<xsl:include href="../-xslt/error.xsl" />
<xsl:template match="add_user">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../-css/logo.css" />
<title>Add User</title>
</head>
<body>
<xsl:call-template name="top_links" />
<form method="POST" actions="add_user.xsql">
<table>
<th>First Name</th><th>Surname</th><th>Email</th><th>Group</th><th>Password</th>
<tr>
<th><input type="text" name="name"
value="" /></th>
<th><input type="text" name="surname"
value="" /></th>
<th><input type="text" name="email"
value="" /></th>
<th><select name="group">
<xsl:apply-templates select="ROWSET/ROW" />
</select></th>
<th><input type="text" name="password"
value="" /></th>
</tr>
</table>
<table cellspacing="20">
<tr>
<input type="submit" value="Add" />
</tr>
</table>
</form>
<tr>
<td><xsl:apply-templates select="//xsql-error" /></td>
</tr>
</body>
</html>
</xsl:template>
<xsl:template match="ROW">
<option>
<xsl:value-of select="." />
</option>
</xsl:template>
</xsl:stylesheet>
(XSQL FILE)
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="../-xslt/add_user.xsl" ?>
<add_user connection="*********" xmlns:xsql="urn:*********">
<xsql:query>
select gtype from GROUPS
</xsql:query>
<xsql:include-request-params />
<xsql:dml bind-params="name surname email group password">
INSERT INTO MANAGER
(mname, msurname, memail, groupID, mpassword)
VALUES
(?,?,?,?,?)
</xsql:dml>
</add_user>
I have an xslt script which is linked to a xsql query which displays gtype in a drop down box. I have a bunch of text boxes to input details to the database. How ever, I need to find a way to look up what has been selected in the drop down box which dislays gtype to put into the insert statement which only accepts the groupID. Would I have to use some kind of trigger of perhaps make another view and insert from there??
Any help would be great..
Regards
Bergs
|