Passing a value from a HTML button to another ASP page HELP!
Passing a value from a HTML button to another ASP page HELP!
am 10.05.2007 16:24:27 von 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
%>
Date
Time
Location
<%
Do until rs.eof
WorkshopNum = rs("WorkshopNum")
WorkshopDate = rs ("WorkshopDate")
WorkshopStartTime = rs("WorkshopStartTime")
WorkshopEndTime = rs("WorkshopEndTime")
WorkshopLocation = rs("WorkshopLocation")
"window.open('editworkshop111.asp'); " value="Edit This Workshop">
td>
<%
session("workshopnum")= workshopnum
rs.movenext
loop
%>
Re: Passing a value from a HTML button to another ASP page HELP!
am 10.05.2007 17:04:43 von Adrienne Boswell
Gazing into my crystal ball I observed djjohnst
writing in news:1178807067.841162.187400@l77g2000hsb.googlegroups.com:
> 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.
Does it have to open in a new window? What about people who hate windows
spawning, like me? Just an observation.
> 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()"
Please do not use * to select fields - name the fields individually.
> rs.open RSSQL,conn,1,1
>
> if rs.recordcount = 0 then
> %> There are no upcoming workshops.
> <%
> response.end
> end if
>
> rs.movefirst
>
> %>
>
>
>
Date
>
Time
>
Location
>
No need for
on a th element. It natively does that.
Better to get rid of presentational markup and use CSS.
>
> "window.open('editworkshop111.asp'); " value="Edit This Workshop">
> td>
>
Where is workshopnum here? Oh - it's not, it's down below and changes as
it loops through. That won't work. You have to put the value somewhere
in an input element. Naming the input element is not going to work
either, because you would have to test for that name coming in from the
request.
What you need is something like name="field" value="<%=workshopnum%>", or
you would put it in a querystring, eg. "window.open('editworkshop111.asp?
field=<%=workshopnum%>');" Then you can get the value from
reques.querystring.
You might want to think about using getrows() as well.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Re: Passing a value from a HTML button to another ASP page HELP!
am 10.05.2007 17:28:31 von djjohnst
Thanx for the response!!!
The thing is that it actually does pass the value of workshopnum to
the buttons! I just don't know how to pull that info out once it is
clicked. The reason i know it works is cause i'll changed
"window.open('editworkshop111.asp'); " value="Edit This Workshop">