Hi
Can anyone help me with this little pulldown menu problem?
I'm creating an Intranet with all employees contact details available. I have created an admin part to the site that allows certain users to log in and add/delete/edit employee details.
I have created two tables, one with employee details and another with centre details (place of work). The centre names are displayed as a pulldown menu from the centreid field.
My problem is that when I try to display the edit_employee.asp page which comes from this code:
SQL="SELECT * FROM Employees WHERE Employees.EmployeeID LIKE '%" &searchTerm& "%' "
it will not display all of the centres in the pulldown menu only the one that is associated with the EmployeeID. I need it to display all of the centres to be able to edit that record.
I have not long started learning ASP so I might have to be hand held. But any help with this would be much appreciated as I need to get this in place soon for our Intranet.
More code below that is on the edit_employee.asp page:
<!-- #include file = "../includes/ADOVBS.INC" -->
<!-- #include file = "../includes/LOGINNOW.ASP" -->
<!--#include file="../includes/connection.asp" -->
<%
Dim Conn
Dim RS
Dim SQL
Dim searchTerm
'create connection object
Set Conn=Server.CreateObject("ADODB.Connection"
Conn.Open Openvar
'Get record EmployeeID from QueryString
searchTerm = Request.QueryString("EmployeeID"
'set and assign structured query statement to variable
SQL="SELECT * FROM Employees WHERE Employees.EmployeeID LIKE '%" &searchTerm& "%' "
'create recordset object
Set RS=Server.CreateObject("ADODB.RecordSet"
'opens the table to view all records and open and lock modes
RS.Open SQL, Conn, 3,3
%>
<!-- Content -->
<form action="employee_edited.asp?EmployeeID=<%=RS("EmployeeID"
%>&operation=EDIT" method="post">
<table>
<tr>
<td class="dataHeader">Centre </td>
<td class="dataContent">
<select name="Centre" class="formFields">
<% ' pick out all the centre names from the primary key in centre table for drop down
Response.Write("<option>" & rs("CentreName"
& "</option>"
%>
</select>
</tr>
<tr>
<td class="dataHeader">Last Name: </td>
<td class="dataContent"><input type="text" name="LastName" value="<%=RS("LastName"
%>" class="formFields"></td>
</tr>
<tr>
<td class="dataHeader">First Name: </td>
<td class="dataContent"><input type="text" name="FirstName" value="<%=RS("FirstName"
%>" class="formFields"></td>
</tr>
<tr>
<td class="dataHeader">Job Title: </td>
<td class="dataContent"><input type="text" name="Title" value="<%=RS("Title"
%>" class="formFields"></td>
</tr>
<tr>
<td class="dataHeader">Title: </td>
<td class="dataContent"><input type="text" name="TitleOfCourtesy" value="<%=RS("TitleOfCourtesy"
%>" class="formFields"></td>
</tr>
</table>
<input type="Submit" value="Edit Employee Details" class="formButton">
</form>
<br><br>
<!-- End Main Outer Table -->
</td>
</tr>
</table>
Can anyone help me with this little pulldown menu problem?
I'm creating an Intranet with all employees contact details available. I have created an admin part to the site that allows certain users to log in and add/delete/edit employee details.
I have created two tables, one with employee details and another with centre details (place of work). The centre names are displayed as a pulldown menu from the centreid field.
My problem is that when I try to display the edit_employee.asp page which comes from this code:
SQL="SELECT * FROM Employees WHERE Employees.EmployeeID LIKE '%" &searchTerm& "%' "
it will not display all of the centres in the pulldown menu only the one that is associated with the EmployeeID. I need it to display all of the centres to be able to edit that record.
I have not long started learning ASP so I might have to be hand held. But any help with this would be much appreciated as I need to get this in place soon for our Intranet.
More code below that is on the edit_employee.asp page:
<!-- #include file = "../includes/ADOVBS.INC" -->
<!-- #include file = "../includes/LOGINNOW.ASP" -->
<!--#include file="../includes/connection.asp" -->
<%
Dim Conn
Dim RS
Dim SQL
Dim searchTerm
'create connection object
Set Conn=Server.CreateObject("ADODB.Connection"
Conn.Open Openvar
'Get record EmployeeID from QueryString
searchTerm = Request.QueryString("EmployeeID"
'set and assign structured query statement to variable
SQL="SELECT * FROM Employees WHERE Employees.EmployeeID LIKE '%" &searchTerm& "%' "
'create recordset object
Set RS=Server.CreateObject("ADODB.RecordSet"
'opens the table to view all records and open and lock modes
RS.Open SQL, Conn, 3,3
%>
<!-- Content -->
<form action="employee_edited.asp?EmployeeID=<%=RS("EmployeeID"
<table>
<tr>
<td class="dataHeader">Centre </td>
<td class="dataContent">
<select name="Centre" class="formFields">
<% ' pick out all the centre names from the primary key in centre table for drop down
Response.Write("<option>" & rs("CentreName"
%>
</select>
</tr>
<tr>
<td class="dataHeader">Last Name: </td>
<td class="dataContent"><input type="text" name="LastName" value="<%=RS("LastName"
</tr>
<tr>
<td class="dataHeader">First Name: </td>
<td class="dataContent"><input type="text" name="FirstName" value="<%=RS("FirstName"
</tr>
<tr>
<td class="dataHeader">Job Title: </td>
<td class="dataContent"><input type="text" name="Title" value="<%=RS("Title"
</tr>
<tr>
<td class="dataHeader">Title: </td>
<td class="dataContent"><input type="text" name="TitleOfCourtesy" value="<%=RS("TitleOfCourtesy"
</tr>
</table>
<input type="Submit" value="Edit Employee Details" class="formButton">
</form>
<br><br>
<!-- End Main Outer Table -->
</td>
</tr>
</table>