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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP in form? 1

Status
Not open for further replies.

Dirtrocker

Technical User
Mar 31, 2002
74
US
If a fella wanted to have a form, like a feedback form, but when it sends, it includes the IP number automatically, how would you go about it?
I'm probably in the wrong forum, but I was thinking that it would be done with javascript for some reason.
 
1. put a hidden form field in the form

2. for the default value enter: <%=Request.ServerVariables(&quot;REMOTE_HOST&quot;)%>

That's it!

:)

John
 
pss. Your page needs to be an ASP page. Forgot to mention that.

Hope it helps. I use that in all of my forms as well.
 
Like this?
Can this be inserted into an html page?

mode = request(&quot;mode&quot;)
if mode=&quot;&quot; then
Function FORM %>
<%=Request.ServerVariables(&quot;REMOTE_HOST&quot;)%>
<form method=&quot;post&quot;>
<table>
<tr>
<td width=&quot;145&quot;><b><font face=&quot;&quot; size=&quot;&quot; color=&quot;<%if a1 = 1 then%>red<%
else%><%end if%>&quot;>Name<%if a1 = 1 then%> <br>
<small><small>min 3 / max </small></small><%end if%></font></b></td>
<td> <font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>
<input type=&quot;text&quot; name=&quot;re1&quot; size=&quot;30&quot; maxlength=&quot;&quot; value=&quot;<%=request(&quot;re1&quot;)%>&quot;>
</font></td>
</tr>
<tr>
<td width=&quot;145&quot;><b><font face=&quot;&quot; size=&quot;&quot; color=&quot;<%if a2 = 1 then%>red<%
else%><%end if%>&quot;>E-mail<%if a2 = 1 then%> <br>
<small><small>min 5 / max </small></small><%end if%></font></b></td>
<td> <font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>
<input type=&quot;text&quot; name=&quot;re2&quot; size=&quot;30&quot; maxlength=&quot;&quot; value=&quot;<%=request(&quot;re2&quot;)%>&quot;>
</font></td>
</tr>
<tr>
<td width=&quot;145&quot;><b><font face=&quot;&quot; size=&quot;&quot; color=&quot;<%if a3 = 1 then%>red<%
else%><%end if%>&quot;>Comments<%if a3 = 1 then%> <br>
<small><small>min 2 / max </small></small><%end if%></font></b></td>
<td> <font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#000000&quot;>
<textarea cols=&quot;50&quot; rows=&quot;8&quot; name=&quot;re3&quot;><%=request(&quot;re3&quot;)%></textarea>
</font></td>
</tr>
<td> </td>
<td>
<input type=&quot;hidden&quot; name=&quot;mode&quot; value=&quot;check&quot;>
<input type=&quot;submit&quot; value=&quot;submit&quot; name=&quot;submit&quot;>
</td>
</table>
</form>
<%End Function%><%FORM%> <%elseif mode = &quot;check&quot; then%><%
if len(request(&quot;re1&quot;)) > 9999 Or len(request(&quot;re1&quot;)) < 3 then
a1 = 1
x = 1
end if
if len(request(&quot;re2&quot;)) > 9999 Or len(request(&quot;re2&quot;)) < 5 then
a2 = 1
x = 1
end if
if len(request(&quot;re3&quot;)) > 9999 Or len(request(&quot;re3&quot;)) < 2 then
a3 = 1
x = 1
end if
if x = 1 then
%><%FORM%><%
else
%>OK<%
end if
end if
%>
 
I don't think it will work like that. Since it is ASP code you have to save the page as nameofpage.asp
sbayter
 
I think Trope meant like
Code:
<input type=&quot;hidden&quot; name=&quot;theIP&quot; value=&quot;<%=Request.ServerVariables(&quot;REMOTE_HOST&quot;)%>&quot;>
inside the form.
And your page is already asp right? Otherwise your other server scripting wouldn't work. Hope I helped / Thanks for helping
if ((x<10&&y<10) &&(((parseInt(x.toString()+y.toString())-x-y)%9)!=0)){ alert(&quot;I'm a monkey's uncle&quot;); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top