Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simple problem for a novice??

2 views
Skip to first unread message

petro...@my-deja.com

unread,
Jan 15, 2000, 3:00:00 AM1/15/00
to
I've created this simple example of ASP to present
a problem I don't understand. First, is the HTML
file; second, is the ASP file. In this example,
I'm using radio buttons to select an option. I
don't have a problem using radio buttons, checkboxes,
text, textarea, etc., but I don't know how to use
anchors. I've tried using post and get methods.

<html>
<head>
</head>
<body>
<form action="default.asp" method="post">
<input name="file" type="radio" value="a">a<br>
<input name="file" type="radio" value="b">b<br>
<input type="submit" value="Submit">
</form>
</body>
</html>

<% @language=vbscript %>
<html>
<head>
</head>
<body>
<%
dim filename
filename = request.form("file")
response.write filename
response.write "<br><hr>"
if filename = "a" then
response.write "<br>a"
end if
%>
</body>
</html>

I can easily replace the input lines with the
following anchors in the HTML file, but I'm not
sure how to access the querystring. default.asp
is not accessable for some reason. What am I
doing wrong?

<a href="default.asp?file=a">a</a>
<a href="default.asp?file=b">b</a>

Next, I want to convert this example to PerlScript.
Is this code close?

<% @language=PerlScript %>
<html>
<head>
</head>
<body>
<%
$filename = $request->form("file");
$response->write(filename);
$response->write("<br><hr>");
if $filename eq "a" {
$response->write("<br>a");
}
%>
</body>
</html>

This simple example will solve a world of problems
for me. I have experience programming client side
applications, but have no experience with server
side applications.

Sent via Deja.com http://www.deja.com/
Before you buy.

Tobias Martinsson

unread,
Jan 16, 2000, 3:00:00 AM1/16/00
to

Hi!

Let's see what we can help you with ...

>default.asp is not accessable for some reason. What am I doing wrong?

From what I saw, you called on default.asp with the "post"-method,
which means that any data is not attached to the querystring but
instead sent with the HTTP body. It will by design be available in the
Form collection. The code would be:

# This is default.asp
<a href="default.asp?file=<%=$Request->Form("filename")->Item()%
>">link</A>

However, there is a problem with the above creation. Namely the
construct of the link uses "?" which indicates that a querystring
follows past the "?" in the URL. This means that you must change your
form method to "GET" and request any data as:

<a href="default.asp?file=<%=$Request->QueryString("filename")->Item()%
>">link</A>

> Next, I want to convert this example to PerlScript.
>

> <% @language=PerlScript %>
> <html>
> <head>
> </head>
> <body>
> <%
> $filename = $request->form("file");
> $response->write(filename);
> $response->write("<br><hr>");

> if($filename eq "a") {


> $response->write("<br>a");
> }
> %>
> </body>
> </html>

Yup. I only added the parenthesis in the if statement.

> This simple example will solve a world of problems
> for me. I have experience programming client side
> applications, but have no experience with server
> side applications.

Happy to be of help :)

--
Tobias

0 new messages