D
djjohnst
I am creating a program that will list program times for people who
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in. However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate > Date()"
rs.open RSSQL,conn,1,1
if rs.recordcount = 0 then
%> There are no upcoming workshops.
<%
response.end
end if
rs.movefirst
%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><div align="center">Date</th>
<th width="300" scope="col"><div align="center">Time</th>
<th width="300" scope="col"><div align="center">Location</th>
</tr>
<%
Do until rs.eof
WorkshopNum = rs("WorkshopNum")
WorkshopDate = rs ("WorkshopDate")
WorkshopStartTime = rs("WorkshopStartTime")
WorkshopEndTime = rs("WorkshopEndTime")
WorkshopLocation = rs("WorkshopLocation")
StartTime = Instr(WorkshopStartTime,":")
EndTime = Instr(WorkshopEndTime,":")
StartAMPM = right(WorkshopStartTime, 2)
EndAMPM=right(WorkshopEndTime, 2)
WorkshopStartTime=Left(WorkshopStartTime, StartTime+2)
WorkshopEndTime=Left(WorkshopEndTime, EndTime+2)
%>
<tr>
<td><div align="center"><%Response.write WorkshopDate%></td>
<td><div align="center"><%Response.write WorkshopStartTime &
StartAMPM & "-" & WorkshopEndTime& EndAMPM%></td>
<td><div align="center"><%Response.write WorkshopLocation%></td>
<td>
<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop"></
td>
</tr>
<%
session("workshopnum")= workshopnum
rs.movenext
loop
%>
visit our website. Users can login create, edit, delete a program.
These dump into a database. The ASP webpage then reads from the
database and posts these programs for people to view (program type,
date, time, etc...). I am having trouble creating an edit option. When
bring up the edit page i want it to read the database and dynamically
create a table that has a button for each record in the recordset. I
want to be able to click that "edit" button and in a new window the
form appears filled out with the current record's information filled
in. However, to do this I am having trouble pulling out the button
name (which is the name of the DB primary key survey num) and passing
it to the other edit form. Some help me....PS i know the below code is
incorrect because it passes 28 which is the last record in the record
set, not the current. I know why it does this, I just do not know how
to fix it.
RSSQL = "Select * from Workshops where workshopdate > Date()"
rs.open RSSQL,conn,1,1
if rs.recordcount = 0 then
%> There are no upcoming workshops.
<%
response.end
end if
rs.movefirst
%>
<table width="499" border="1">
<tr>
<th width="139" scope="col"><div align="center">Date</th>
<th width="300" scope="col"><div align="center">Time</th>
<th width="300" scope="col"><div align="center">Location</th>
</tr>
<%
Do until rs.eof
WorkshopNum = rs("WorkshopNum")
WorkshopDate = rs ("WorkshopDate")
WorkshopStartTime = rs("WorkshopStartTime")
WorkshopEndTime = rs("WorkshopEndTime")
WorkshopLocation = rs("WorkshopLocation")
StartTime = Instr(WorkshopStartTime,":")
EndTime = Instr(WorkshopEndTime,":")
StartAMPM = right(WorkshopStartTime, 2)
EndAMPM=right(WorkshopEndTime, 2)
WorkshopStartTime=Left(WorkshopStartTime, StartTime+2)
WorkshopEndTime=Left(WorkshopEndTime, EndTime+2)
%>
<tr>
<td><div align="center"><%Response.write WorkshopDate%></td>
<td><div align="center"><%Response.write WorkshopStartTime &
StartAMPM & "-" & WorkshopEndTime& EndAMPM%></td>
<td><div align="center"><%Response.write WorkshopLocation%></td>
<td>
<input name="<%Response.Write WorkshopNum%>" type=Button onclick=
"window.open('editworkshop111.asp'); " value="Edit This Workshop"></
td>
</tr>
<%
session("workshopnum")= workshopnum
rs.movenext
loop
%>