Help needed to pass form result to string

P

Pete

Hello all

I have a form which passes an IP address to another page which then runs a
function to resolve a host name. I am trying to pass the form name 'ip' to
the string, but am having problems with the syntax. Have now spent 5 hours
on this and am calling for help.
many thanks

Pete
......................
Original string script which works has a manually entered Ip in the string
like this.

<%
Dim netDLL

Set netDLL = Server.CreateObject("NETDLL.Network")
' Display the hostname of the provided IP (yahoo's IP)
Response.Write "<b>GetHostFromIP:</b> " &
netDLL.GetHostFromIP("216.115.108.243")
%>

I am trying to get the form parameter into the string as follows, but it
fails no matter how I try.

<%
Dim ip
ip = Request.Form("ip")
%>
<%
Dim netDLL
Set netDLL = Server.CreateObject("NETDLL.Network")
Response.Write "<b>GetHostFromIP:</b> " & netDLL.GetHostFromIP
("<%Response.Write("ip")%>")
%>
 
T

Thomas 'PointedEars' Lahn

Pete said:
I have a form which passes an IP address to another page which then runs a
function to resolve a host name. I am trying to pass the form name 'ip' to
the string, but am having problems with the syntax. Have now spent 5 hours
on this and am calling for help.

Worng newsgroup, you are using VBScript.


PointedEars
 
E

Evertjan.

Pete wrote on 17 aug 2004 in comp.lang.javascript:
<%
Dim ip
ip = Request.Form("ip")
%>
<%
Dim netDLL
Set netDLL = Server.CreateObject("NETDLL.Network")
Response.Write "<b>GetHostFromIP:</b> " & netDLL.GetHostFromIP
("<%Response.Write("ip")%>")
%>

While not understanding the workings of "NETDLL.Network":

<%
Set netDLL = Server.CreateObject("NETDLL.Network")
result = netDLL.GetHostFromIP(Request.Form("ip"))
Response.Write "<b>GetHostFromIP:</b> " & result
%>
 
P

Pete

Thanks a lot. It worked like a charm.
Pete

Evertjan. said:
Pete wrote on 17 aug 2004 in comp.lang.javascript:

While not understanding the workings of "NETDLL.Network":

<%
Set netDLL = Server.CreateObject("NETDLL.Network")
result = netDLL.GetHostFromIP(Request.Form("ip"))
Response.Write "<b>GetHostFromIP:</b> " & result
%>
 
G

Grant Wagner

Pete said:
<%
Dim ip
ip = Request.Form("ip")
%>
<%
Dim netDLL
Set netDLL = Server.CreateObject("NETDLL.Network")
Response.Write "<b>GetHostFromIP:</b> " & netDLL.GetHostFromIP
("<%Response.Write("ip")%>")
%>

This isn't JavaScript, it isn't even JScript, but it shouldn't be difficult to
get it working...

<%
Dim ipVar
ipVar = Request.Form("ip")
Dim netDLL
Set netDLL = Server.CreateObject("NETDLL.Network")
Response.Write "<b>GetHostFromIP:</b> " & netDLL.GetHostFromIP(ipVar)
%>

Assuming I've read the documentation for Request.Form() correctly and it
returns a string, then the above will work. You put the value of the form
element named "ip" into a variable called "ipVar", you pass the contents of
that variable to the function.

I've renamed the variable "ipVar" to demonstrate you are setting, then passing
the value of, that variable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top