Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Newbie would appreciate help :)

Reply
Thread Tools

Newbie would appreciate help :)

 
 
Heather
Guest
Posts: n/a
 
      08-14-2003
Hi

I have been struggling with this problem for days now and not really
getting anywhere. I am new to this so apologies for bad coding etc.

I have a form where the student enters his enrolment number and this
number is passed from the asp form to a SQL database. So far so good.

Now when he doesnt have an enrolment number he writes his name. Now,
I want to pass the enrolment number as 0, that bit is working ok, and
pass the name into a special field called s1.

My code is passing too much. It passes the enrolment number as 0, the
name as s1 but also sends the "click here to continue" text.

Here is a snippet of the code. I feel that I am putting in too
many/leaving out quote marks.

I would be grateful for any help.

Many thanks

Heather

dim var
dim choice
dim stname
dim stcoursecode
dim stcoursename
dim enrol
dim stdob


stdob = request.form("stdob")
enrol = request.form("enrolment")
choice = request.form("stchoice")
stname = request.form("stName")
stcoursecode = request.form("stcoursecode")
stcoursename = request.form("stcoursename")
var = request.form("stlevel")%>



<% if var = "1" then
Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=7234121865394181" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
else

if var = "2" then
Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=9952819590936663" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
else

if var = "3" then
Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=6083780287200261" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"


end if
end if
end if %>
</strong> </font> </p>
</form>
 
Reply With Quote
 
 
 
 
Dan Sikorsky
Guest
Posts: n/a
 
      08-14-2003
You left out the initial <% at the beginning.

You left out the '&' that delimits each parameter in the QueryString of your
<a href statements.

--
Thank you,

Dan Sikorsky MSCS, BSCE, BAB


"Heather" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi
>
> I have been struggling with this problem for days now and not really
> getting anywhere. I am new to this so apologies for bad coding etc.
>
> I have a form where the student enters his enrolment number and this
> number is passed from the asp form to a SQL database. So far so good.
>
> Now when he doesnt have an enrolment number he writes his name. Now,
> I want to pass the enrolment number as 0, that bit is working ok, and
> pass the name into a special field called s1.
>
> My code is passing too much. It passes the enrolment number as 0, the
> name as s1 but also sends the "click here to continue" text.
>
> Here is a snippet of the code. I feel that I am putting in too
> many/leaving out quote marks.
>
> I would be grateful for any help.
>
> Many thanks
>
> Heather
>
> dim var
> dim choice
> dim stname
> dim stcoursecode
> dim stcoursename
> dim enrol
> dim stdob
>
>
> stdob = request.form("stdob")
> enrol = request.form("enrolment")
> choice = request.form("stchoice")
> stname = request.form("stName")
> stcoursecode = request.form("stcoursecode")
> stcoursename = request.form("stcoursename")
> var = request.form("stlevel")%>
>
>
>
> <% if var = "1" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=7234121865394181" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
>
> if var = "2" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=9952819590936663" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
>
> if var = "3" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=6083780287200261" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
>
>
> end if
> end if
> end if %>
> </strong> </font> </p>
> </form>



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      08-14-2003
You're not closing your hrefs. Do a view source, and you'll see your HTML
is like:

<A href="http://...stuff...>Click here

It should be like:

<A href="http://...stuff...">Click here

A couple of suggestions about the code.

Instead of if/then/end ifs all over, use a select case:


Select Case var
Case "1"
sSession = "7234121865394181"
Case "2"
sSession = "9952819590936663"
Case "3"
sSession = "6083780287200261"
Case Else
''this is optional
End Select

sHref = "http://perception/q/open.dll?NAME=" & Recordset("enrolment") &
"&session=" & sSession & "&s1=" & Recordset("stName")

Response.Write "<A href=""" & sHref & """>Click here to continue</A>"

Suggestion:
Don't use Recordset("name")
Use
Recordset.Fields.Item(0).Value '''where the number is the index of the
columns in your query, starting at 0

Suggestion:
Put spaces before and after your & concatenator. You'll run into troubles
with variables that start with H, otherwise (&H implies hex number to
follow).

Ray at work



Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=7234121865394181" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
else

if var = "2" then
Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=9952819590936663" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
else

if var = "3" then
Response.Write "<a href= ""http://perception/q/open.dll?NAME="
&Recordset1("enrolment") & "&SESSION=6083780287200261" & "s1="
&Recordset1("stName") & ">" & "Please click here to continue" & "</a>"


"Heather" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi
>
> I have been struggling with this problem for days now and not really
> getting anywhere. I am new to this so apologies for bad coding etc.
>
> I have a form where the student enters his enrolment number and this
> number is passed from the asp form to a SQL database. So far so good.
>
> Now when he doesnt have an enrolment number he writes his name. Now,
> I want to pass the enrolment number as 0, that bit is working ok, and
> pass the name into a special field called s1.
>
> My code is passing too much. It passes the enrolment number as 0, the
> name as s1 but also sends the "click here to continue" text.
>
> Here is a snippet of the code. I feel that I am putting in too
> many/leaving out quote marks.
>
> I would be grateful for any help.
>
> Many thanks
>
> Heather
>
> dim var
> dim choice
> dim stname
> dim stcoursecode
> dim stcoursename
> dim enrol
> dim stdob
>
>
> stdob = request.form("stdob")
> enrol = request.form("enrolment")
> choice = request.form("stchoice")
> stname = request.form("stName")
> stcoursecode = request.form("stcoursecode")
> stcoursename = request.form("stcoursename")
> var = request.form("stlevel")%>
>
>
>
> <% if var = "1" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=7234121865394181" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
>
> if var = "2" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=9952819590936663" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
>
> if var = "3" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=6083780287200261" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
>
>
> end if
> end if
> end if %>
> </strong> </font> </p>
> </form>



 
Reply With Quote
 
Kris Eiben
Guest
Posts: n/a
 
      08-14-2003
You haven't closed the quote enclosing the href. Plus, this has nothing
to do with your problem, but you could use elseif or select case to
eliminate the nested if statements.

"Heather" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi
>
> I have been struggling with this problem for days now and not really
> getting anywhere. I am new to this so apologies for bad coding etc.
> I have a form where the student enters his enrolment number and this
> number is passed from the asp form to a SQL database. So far so good.
> Now when he doesnt have an enrolment number he writes his name. Now,
> I want to pass the enrolment number as 0, that bit is working ok, and
> pass the name into a special field called s1.
> My code is passing too much. It passes the enrolment number as 0, the
> name as s1 but also sends the "click here to continue" text.
> Here is a snippet of the code. I feel that I am putting in too
> many/leaving out quote marks.
> I would be grateful for any help.
> Many thanks
> Heather
> dim var
> dim choice
> dim stname
> dim stcoursecode
> dim stcoursename
> dim enrol
> dim stdob
> stdob = request.form("stdob")
> enrol = request.form("enrolment")
> choice = request.form("stchoice")
> stname = request.form("stName")
> stcoursecode = request.form("stcoursecode")
> stcoursename = request.form("stcoursename")
> var = request.form("stlevel")%>
> <% if var = "1" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=7234121865394181" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
> if var = "2" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=9952819590936663" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> else
> if var = "3" then
> Response.Write "<a href= ""http://perception/q/open.dll?NAME="
> &Recordset1("enrolment") & "&SESSION=6083780287200261" & "s1="
> &Recordset1("stName") & ">" & "Please click here to continue" & "</a>"
> end if
> end if
> end if %>
> </strong> </font> </p>
> </form>



 
Reply With Quote
 
Heather
Guest
Posts: n/a
 
      08-18-2003
Thank you for taking the trouble to respond. I have now solved my
problem with a lot of trial and error.

Many thanks

Heather
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
would greatly appreciate answer to compaq memory question cerebureaucracy@hotmail.com Computer Information 7 07-19-2006 10:42 AM
Requesting: Looking for "from dusk till dawn 2", would appreciate it very much, thanks in advance blind ferrot@please.help DVD Video 2 12-11-2004 09:28 PM
Newbie would appreciate opinions on e-Xoops websites.... VinnyH HTML 2 11-22-2003 01:07 AM
Would appreciate your opinion! What's In A Name? Computer Support 24 10-19-2003 05:04 AM
Problem with JDBC socket, i would greatly appreciate some advice =) Tom Java 3 08-15-2003 02:36 PM



Advertisments