Solved

Trying to get an ASP hidden form field variable to work

Posted on 2009-07-05
12
223 Views
Last Modified: 2012-05-07
Can anyone please tell me what I need to set the value of the hidden field CPUName to get it to have it show the CompName variable?? Thanks. Jon

<%
   Dim DNS
   Dim IP
   Dim CompName

   Set DNS = Server.CreateObject("ASPDNS.DNSLookup")
   IP = (Request.ServerVariables("REMOTE_ADDR"))
   CompName = DNS.GetNameFromIP(IP)
   Response.Write "At Computer Name: " & CompName
   <input name="CPUName" type="hidden" value="'(CompName)'" />
%>
0
Comment
Question by:Jon DeVito
  • 7
  • 5
12 Comments
 
LVL 30

Accepted Solution

by:
Wayne Barron earned 500 total points
ID: 24782398
Give this a shot.
I do not have that component so I cannot fully test it.

Good Luck
Carrzkiss
<%

   Dim DNS

   Dim IP

   Dim CompName
 

   Set DNS = CreateObject("ASPDNS.DNSLookup")

   IP = (Request.ServerVariables("REMOTE_ADDR"))

   CompName = DNS.GetNameFromIP(IP)

   Response.Write "At Computer Name: " & CompName

   Response.Write "<input name=""CPUName"" type=""hidden"" value="""&(CompName)&""" />"

%>

Open in new window

0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782408
Thanks, I get this error:

Microsoft VBScript compilation error '800a0400'

Expected statement

/TimeClock_PunchIn.asp, line 150

<input name="CPUName" type="hidden" value="'& (CompName) &'"/>
^
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24782552
See if you get the error with this?

Run the code and click the button
<form method="post">

<input type="hidden" name="Hello" value="Carrzkiss" />

<input type="submit" />

</form>

<%

   Dim DNS

   Dim IP

   Dim CompName
 

  ' Set DNS = CreateObject("ASPDNS.DNSLookup")

  ' IP = (Request.ServerVariables("REMOTE_ADDR"))

   'CompName = DNS.GetNameFromIP(IP)

   CompName = request.form("Hello")

   Response.Write "At Computer Name: " & CompName

   Response.Write "<input name=""CPUName"" type=""hidden"" value="""&(CompName)&""" />"

%>

Open in new window

0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782606
Yes that works when I submit it.
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782621
Sorry, i'm wrong...
It only outputs:

At Computer Name: Carrzkiss
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782629
I think I'm totally confused here, lol.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24782646
If that works.
Then yours should work as well.
I downloaded the components but have not installed them.
I can do this and it runs fine. so yours should run as well.

That is about all that I can do without fully testing the component with your script.
I will have to do that later on this evening of tomorrow.
Right now I am behind on a site that suppose to be released in the morning.

Have a good one.
Carrzkiss
<%

   Dim DNS

   Dim IP

   Dim CompName
 

  ' Set DNS = CreateObject("ASPDNS.DNSLookup")

  ' IP = (Request.ServerVariables("REMOTE_ADDR"))

   'CompName = DNS.GetNameFromIP(IP)

   CompName = Request.ServerVariables("REMOTE_ADDR")

   Response.Write "At Computer Name: " & CompName

   Response.Write "<input name=""CPUName"" type=""hidden"" value="""&(CompName)&""" />"

%>

Open in new window

0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782675
You are totally right...I must have misspelled something the first time. Thank you so much!! Good luck with the launch tomorrow!!

Jon
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24782734
You are welcome.
And thank you for the Good Luck.

I am hiring my Mother to Promote the Site via Phone Calls to different companies.
And right now I am writting up the information for here to give to the companies about
The site.

It has been a 6 month old project that I am happy to say is 99.99%
have .01% left to complete and if it is not done by this evening, then I am going to have to
Remove that part of it, until it is fixed, as the site has got to go live by tomorrow.

Have a good one.
Carrzkiss
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782780
Moms are always great for that kind of stuff =)
Awesome to hear you're almost done. Good luck with everything, I hope you can finish it up tonight. Thanks so much for the help! I really appreciate it!

Gave a great night.
Jon
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 24782781
I meant Have a great night, lol. It's late =)
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24782893
To bad you cannot "Gave" me a great night, that would be awesome.
Getting tired, but have to atleast finish up a few more things, then i will call it a night.
And start on it about 6:00am, to get it out the door (so to speak) by 10:00am.

(Yep Mom's are awesome. I told me Mom that it was my turn to take care of her, tired of see her working long hours and not making nothing to show for it. I am 38, it is time for me to take care of Her now)

Have a good one.
Carrzkiss
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Smart quotes being changed on insert 9 50
Classic ASP connection string to Microsoft SQL Server 2014 database 11 237
EOF BOF error classic asp 8 43
XML Parsing Classic ASP 5 51
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now