Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

request.form/querystring not working!!

Status
Not open for further replies.

phentalmyst

Programmer
Jan 30, 2001
18
US
hey all,

im simply trying to pull the data from a form and then update the database with the new stuff, but the form values are passing properly. any help with this will be GREATLY appreciated!

my form submit looks like this:

************

<%@ Language=VBScript %>
<!--#include file=&quot;securitylevel3required.asp&quot;-->
<%
strConnectionString = &quot;Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\ set conn = server.createobject(&quot;ADODB.Connection&quot;)
conn.open strConnectionString
%>
<html>

<head>
<title>\\ moongroover -- the official website //</title>
<link rel=&quot;stylesheet&quot; href=&quot;../moon.css&quot;>
<%
groover = Request.Querystring(&quot;groover&quot;)

SQL=&quot;SELECT groover, first_name, last_name, instruments, email, influences, justin, brian, joel, kris, nishan, unknown_fact FROM bios Where groover=&quot;&groover
set admin = conn.Execute(SQL)


' justin thoughts
justinstr = &quot;<div id=normtxtgrey>Thoughts on Justin: (<font color=006699>max 255 characters of text</font>)</div><textarea name=&quot; & chr(34) & &quot;justin&quot; & chr(34) & &quot; cols=&quot; & chr(34) & &quot;45&quot; & chr(34) & &quot; rows=&quot; & chr(34) & &quot;4&quot; & chr(34) & &quot;></textarea><br><br>&quot;
java01str = &quot;document.bioedit.justin.value=&quot; & chr(34) & admin(6) & chr(34) & &quot;; &quot;

' brian thoughts
brianstr = &quot;<div id=normtxtgrey>Thoughts on Brian: (<font color=006699>max 255 characters of text</font>)</div><textarea name=&quot; & chr(34) & &quot;brian&quot; & chr(34) & &quot; cols=&quot; & chr(34) & &quot;45&quot; & chr(34) & &quot; rows=&quot; & chr(34) & &quot;4&quot; & chr(34) & &quot;></textarea><br><br>&quot;
java02str = &quot;document.bioedit.brian.value=&quot; & chr(34) & admin(7) & chr(34) & &quot;; &quot;

' joel thoughts
joelstr = &quot;<div id=normtxtgrey>Thoughts on Joel: (<font color=006699>max 255 characters of text</font>)</div><textarea name=&quot; & chr(34) & &quot;joel&quot; & chr(34) & &quot; cols=&quot; & chr(34) & &quot;45&quot; & chr(34) & &quot; rows=&quot; & chr(34) & &quot;4&quot; & chr(34) & &quot;></textarea><br><br>&quot;
java03str = &quot;document.bioedit.joel.value=&quot; & chr(34) & admin(8) & chr(34) & &quot;; &quot;

' kris thoughts
krisstr = &quot;<div id=normtxtgrey>Thoughts on Kris: (<font color=006699>max 255 characters of text</font>)</div><textarea name=&quot; & chr(34) & &quot;kris&quot; & chr(34) & &quot; cols=&quot; & chr(34) & &quot;45&quot; & chr(34) & &quot; rows=&quot; & chr(34) & &quot;4&quot; & chr(34) & &quot;></textarea><br><br>&quot;
java04str = &quot;document.bioedit.kris.value=&quot; & chr(34) & admin(9) & chr(34) & &quot;; &quot;

' nishan thoughts
nishanstr = &quot;<div id=normtxtgrey>Thoughts on Nishan: (<font color=006699>max 255 characters of text</font>)</div><textarea name=&quot; & chr(34) & &quot;nishan&quot; & chr(34) & &quot; cols=&quot; & chr(34) & &quot;45&quot; & chr(34) & &quot; rows=&quot; & chr(34) & &quot;4&quot; & chr(34) & &quot;></textarea><br>&quot;
java05str = &quot;document.bioedit.nishan.value=&quot; & chr(34) & admin(10) & chr(34) & &quot;; &quot;

' justins thought string

If groover = &quot;1&quot; Then
thoughtstr = brianstr & joelstr & krisstr & nishanstr
End if

If groover = &quot;1&quot; Then
javastr = java02str & java03str & java04str & java05str


End if


' brians thoughts

If groover = &quot;2&quot; Then
thoughtstr = justinstr & joelstr & krisstr & nishanstr
End if

If groover = &quot;2&quot; Then
javastr = java01str & java03str & java04str & java05str

End If


' joels thoughts

If groover = &quot;3&quot; Then
thoughtstr = justinstr & brianstr & krisstr & nishanstr
End if

If groover = &quot;3&quot; Then
javastr = java01str & java02str & java04str & java05str

End If


' kris thoughts

If groover = &quot;4&quot; Then
thoughtstr = justinstr & brianstr & joelstr & nishanstr
End if

If groover = &quot;4&quot; Then
javastr = java01str & java02str & java03str & java05str

End If


' neeshs thoughts

If groover = &quot;5&quot; Then
thoughtstr = justinstr & brianstr & joelstr & krisstr

End If

If groover = &quot;5&quot; Then
javastr = java01str & java02str & java03str & java04str
End If

%>
<script language=&quot;javascript&quot;>
<!--

function toss_info(){
document.bioedit.instruments.value = <%=chr(34) & admin(3) & chr(34)%>;
document.bioedit.email.value = <%=chr(34) & admin(4) & chr(34)%>;
document.bioedit.influences.value = <%=chr(34) & admin(5) & chr(34)%>;
document.bioedit.unknown_fact.value = <%=chr(34) & admin(11) & chr(34)%>;
<%=javastr%>;

}
//-->
</script>
<script language=&quot;javascript&quot;>
<!--

function update(){
document.bioedit.submit();

}
//-->
</script>
</head>

<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot; link=&quot;#FFFFFF&quot; vlink=&quot;#FFFFFF&quot; alink=&quot;#000000&quot;>

<div align=&quot;center&quot;>
<center>
<table border=&quot;0&quot; width=&quot;660&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td height=&quot;40&quot;>
<div id=&quot;head01&quot;><b>&nbsp;Moongroover - the official website</b></div>
</td>
</tr>
<tr>
<td>&nbsp; </td>
</tr>
<tr>
<td>
<div id=&quot;normtxtwhite&quot;>
<table width=&quot;660&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td rowspan=&quot;2&quot; width=&quot;120&quot;><img src=&quot;../images/i_spc01.gif&quot; width=&quot;1&quot; height=&quot;35&quot;></td>
<td rowspan=&quot;2&quot; width=&quot;420&quot;>
<p>&nbsp;</p>
</td>
<td rowspan=&quot;2&quot; width=&quot;120&quot;>&nbsp;</td>
</tr>
<tr> </tr>
<tr>
<td valign=&quot;top&quot;>&nbsp;</td>
<td valign=&quot;top&quot;>
<div id=&quot;head02&quot;></div>
<form name=&quot;bioedit&quot; method=&quot;post&quot; action=&quot; <table width=&quot;420&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td>
<div id=&quot;normtxtwhite&quot;>Hey <%=admin(1)%>, here's your
bio, so play wif it already!</div>
<br>
<div id=&quot;normtxtgrey&quot;>Instrument(s): (<font color=&quot;#006699&quot;>max
255 characters of text</font>)</div>
<input type=&quot;text&quot; name=&quot;instruments&quot; value=&quot;test&quot; maxlength=&quot;255&quot; size=&quot;50&quot;>
<div id=&quot;normtxtgrey&quot;><br>
Email: (<font color=&quot;#006699&quot;>max 255 characters of
text</font>)</div>
<input type=&quot;text&quot; name=&quot;email&quot; maxlength=&quot;255&quot; size=&quot;30&quot;>
<div id=&quot;normtxtgrey&quot;><br>
Influences: (<font color=&quot;#006699&quot;>max 255 characters
of text</font>)</div>
<textarea name=&quot;influences&quot; cols=&quot;45&quot; rows=&quot;4&quot;></textarea>
<div id=&quot;normtxtgrey&quot;><br>
<%=thoughtstr%></div>
<div id=&quot;normtxtgrey&quot;>
<p>Unknown Fact About Mr. <%=admin(2)%> (<font color=&quot;#006699&quot;>max
255 characters of text</font>)<br>
<input type=&quot;text&quot; name=&quot;unknown_fact&quot; maxlength=&quot;255&quot; size=&quot;50&quot;>
<input type=&quot;hidden&quot; name=&quot;groover&quot; value=&quot;<%=admin(0)%>&quot;>
</p>
</div>
</td>
</tr>
<tr align=&quot;center&quot;>
<td><br><br><input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submit&quot;></td>
</tr>
</table>
</form>
</td>
<td valign=&quot;top&quot;>&nbsp; </td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>

</body>

</html>

************

and the submit page is here:

************

<%@ LANGUAGE = VBScript %>
<html>

<head>
<title>moongroover editor</title>

<%
' declaring variables
' not neccesary but a good habit
Dim DataConn
Dim CmdUpdateRecord
Dim MYSQL

Set DataConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set CmdUpdateRecord = Server.CreateObject(&quot;ADODB.Recordset&quot;)

' The line below shows how to use a system DSN instead of a DNS-LESS connection
' DataConn.Open &quot;DSN=System_DSN_Name&quot;
DataConn.Open &quot;DBQ=&quot; & Server.Mappath(&quot;../data/bios.mdb&quot;) & &quot;;Driver={Microsoft Access Driver (*.mdb)};&quot;


edited = request(&quot;groover&quot;)
instruments = request(&quot;instruments&quot;)

MYSQL = &quot;SELECT instruments FROM bios WHERE groover=&quot;&edited

CmdUpdateRecord.Open MYSQL, DataConn, 1, 3

CmdUpdateRecord.Fields(&quot;instruments&quot;) = instruments
CmdUpdateRecord.Update

' closing objects and setting them to nothing
' not neccesary but a good habit
CmdUpdateRecord.Close
Set CmdUpdateRecord = Nothing
DataConn.Close
Set DataConn = Nothing
%>

</head>

<body>
<center>Good job <%=edited%>!!</center><br><br><%= request(&quot;instruments&quot;) %>
</body>
</html>

******************

thanks!!!
 
when you ask for form variables, you should ask for request.form

hope it helps! :)
 
I think what link9 means to say is that when you use METHOD=&quot;POST&quot; to send data to an ASP page, you need to use request.form. When you omit METHOD or use METHOD=&quot;GET&quot; then you use request.querystring

If you have a form that you want to both get and post to, you can do the following...

if isEmpty(request.form) then
if isEmpty(request.querystring) then
response.write &quot;You can not access this page directly&quot;
else
set req = request.querystring
end if
else
set req = request.form
end if

myvar = req(&quot;form_variable_name&quot;)
 
Although the following is not appreciated by the server in terms of performance, you can also use the following:

myvar = request(&quot;form_variable_name&quot;)

The default property is to scan all collections (.form, .querystring, .cookies etc) for the given named argument..

(It's a workaround, so I'd go for the Swany-approach!) Yours,

Rob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top