|
-
Jan 25th, 2005, 06:02 PM
#1
Thread Starter
Hyperactive Member
Know-nothing-newbie question
I do not know anything about ASP. I know little more about HTML. I hope this is not too ridiculously large a question:
In general, how do you get an .htm page to accept passed values via the url?
I have a few .htm pages created with DreamWeaver MX. They have very little scripting going on. Maybe a submit button that sends some info to an email address. I read in their help that you needed some kind of Get method to accept such parameters.
Can anyone explain in general what needs to be inserted into such an .htm document so that I can pass it a parameter on the url. So I can do something like:
www.mysite.com/mypage.htm/?companyname="this is the company name"
One other question: is there such a thing as "converting" plain old .htm's to .asp pages? If so, can it be done via some kind of wizard in asp.net? vb.net? whoo-ha.not?
Thanks to anyone who cares.
-
Jan 25th, 2005, 09:26 PM
#2
Re: Know-nothing-newbie question
I do not know anything about ASP. I know little more about HTML. I hope this is not too ridiculously large a question:
In general, how do you get an .htm page to accept passed values via the url?
I have a few .htm pages created with DreamWeaver MX. They have very little scripting going on. Maybe a submit button that sends some info to an email address. I read in their help that you needed some kind of Get method to accept such parameters.
Can anyone explain in general what needs to be inserted into such an .htm document so that I can pass it a parameter on the url. So I can do something like:
www.mysite.com/mypage.htm/?companyname="this is the company name"
To answer you question, unfortunately there is no way you can use .htm file to pass variables like you are mentioning. HTML was not designed for this purpose.
Saying that, i have seen some work around using JavaScript but thats a bit too advanced for a beginner like you. If you have no other alternatives I will exlain it to you.
One other question: is there such a thing as "converting" plain old .htm's to .asp pages? If so, can it be done via some kind of wizard in asp.net? vb.net? whoo-ha.not?
If your html is "plain old" like you mentiond meaning no "Server Side" code then all you need to do is rename it to a .asp file thats all. As for ASP.Net its a different ball game, even converting asp page to asp.net is not easy.
Thanks to anyone who cares.
You are welcome, hope I have helped.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Jan 25th, 2005, 11:22 PM
#3
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
Thanks Danial. Well, you drew attention to yourself so I'm going to ask again.
I agree that I don't know anything about JavaScript, but can you explain: Is it just a chunk of code to insert inside the html, like some tag says "ok here's some java script", then you have the script, then some tag says "ok, script done"? Is it that simple as far as inserting script?
Can you point me to an example of JavaScript that would do it? (oooh that was the really hard one, sorry).
Given an example, notepad.exe and the refresh button on the browser, I've gotten html to do things I wanted it to do without really understanding what it is I did. I may also just be passing this on to the web person that invented these .htm pages.
I hope all agree with you that you cannot do what I want with plain old html.
Thanks again.
-
Jan 26th, 2005, 02:45 AM
#4
Fanatic Member
Re: Know-nothing-newbie question
 Originally Posted by vbmom
I agree that I don't know anything about JavaScript, but can you explain: Is it just a chunk of code to insert inside the html, like some tag says "ok here's some java script", then you have the script, then some tag says "ok, script done"? Is it that simple as far as inserting script?
Yes it's as simple as that.
 Originally Posted by danial
To answer you question, unfortunately there is no way you can use .htm file to pass variables like you are mentioning. HTML was not designed for this purpose.
This is correct, but you can do it using ASP.
If you have an address that looks like this:
Code:
www.test.com/page.asp?fname=Tobbe&lname=McCain
You can get fname and lname like this:
Code:
<%
response.write(request.querystring("fname"))
response.write(" " & request.querystring("lname"))
%>
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 26th, 2005, 08:20 AM
#5
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
Thanks Tobbe. Unfortunately, I cannot use my old trial and error trick to check that out, am I right? I need a web server which I don't have, true?
Not true?
But this is a start and I will pass it along to the web person. Thank you.
Hey, do ever see any 544's rolling around there?
-
Jan 26th, 2005, 08:30 AM
#6
Re: Know-nothing-newbie question
 Originally Posted by vbmom
Thanks Danial. Well, you drew attention to yourself so I'm going to ask again.
Can you point me to an example of JavaScript that would do it? (oooh that was the really hard one, sorry).
I hope all agree with you that you cannot do what I want with plain old html.
Thanks again.
Its a accpted fact that we can not use plain old html to pass variable. What I was referring to was workaround using javascript. It involves writing own custom javascript function, which will read the URL and extract the parameters. You will have to run this function OnLoad event of the doucment and then process those parameter as you wish. Not too complex but a bit fiddly.
As for examples I dont have any, i heard about the concept somewhere. I could put together one but it will have to be somtime later.
 Originally Posted by vbmom
I cannot use my old trial and error trick to check that out, am I right? I need a web server which I don't have, true?
Yes you can, if you are using any recent windows version e.g Win2K, XP Pro then you can use IIS to run a web server in your machine and test your script. Alternatively you can get an account with some free host such as Brinkster.com and upload your script there and test it online.
Hope this helps.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Jan 26th, 2005, 04:22 PM
#7
Fanatic Member
Re: Know-nothing-newbie question
You really should get a webserver up and running.
Writing webpages are so much more fun when you can use a scripting language like ASP or PHP!
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 26th, 2005, 05:08 PM
#8
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
You're right. We have one in the office and I managed to write code to do it. In case anyone is following along...
I inserted this after the start of the body portion of the html:
Code:
<%
Dim sName, sCompany, sNumBackedUp, sNumMgrs
sName = request.querystring("realname")
sCompany = request.querystring("Company")
sNumBackedUp = request.querystring("NumBackedUp")
sNumMgrs = request.querystring("NumMgrs")
%>
Then, down where the code sets up the input values, I did things like this:
<input name="realname" type="text" value=<% =sName %>
That did the trick, however, I found that if those querystrings were not supplied on the URL, things got funky on the form, so I inserted a bunch of If blocks in the ASP code on top like:
If sName = "" or sName = NULL then
sName = "." End If
Maybe you can answer this... I had to use some character to assign the variables if they were NULL, I couldn't just say sName = "" or sName = " ". I got the same funkiness when I did. So I assigned a dot instead.
The whole exercise does push the point that passing strings along the URL is not the most elegant way to do this. The thing we like about doing it this way, however, is that it avoids having to write cookies on the user's box--another way of doing this I know nothing about!
-
Jan 27th, 2005, 04:44 AM
#9
Fanatic Member
Re: Know-nothing-newbie question
You could use the isempty(request.querystring("realname") function
Or Len(request.querystring("realname"))>1
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 27th, 2005, 07:06 AM
#10
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
I think you misunderstood. If the querystring was empty I had to assign a character to the variable so that it would not cause problems on the form.
If I had left it empty or even assigned a space character, the value = <% sVariable %> statement seemed to render the text <% sVariable %> null, so that the text assigned to the textbox via the value= was whatever followed <%...%> on the command line.
-
Jan 27th, 2005, 10:48 AM
#11
Fanatic Member
Re: Know-nothing-newbie question
I'm sorry I missunderstood you. It must be my lacking English skills. And to be honest I'm still not sure I understand.
Are you saying that if sVariable == "" or sVariable == " " the value would actually be sVariable?
You would litteraly see the text sVariable in the input field?
It probably doesn't matter but you should have quotes around the value. So the line would look something like this:
HTML Code:
<input name="realname" type="text" value="<% =sName %>" />
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 27th, 2005, 10:53 AM
#12
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
Ok, sorry I did not explain what I meant by the form being funky.
When sName is empty (i.e. sName = "" or sName = NULL or sName = " "), this statement:
<input name="realname" type="text" value=<% =sName %> id="realname" size="30">
Inserts id="realname" or parts of that string into the textbox.
-
Jan 27th, 2005, 12:18 PM
#13
Fanatic Member
Re: Know-nothing-newbie question
Ohh, that could very much be because you don't have any quotes around the value.
Try looking at the source of the page from the webbrowser (i.e. after it has passed through the webserver) and see if you spot any oddities
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
Jan 27th, 2005, 01:02 PM
#14
Thread Starter
Hyperactive Member
Re: Know-nothing-newbie question
I'll try the quotes. Thanks Tobbe. And you're English is not bad at all. You should hear my Swedish.
-
Jan 27th, 2005, 01:42 PM
#15
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|