multipart form processing

Discussion in 'ASP General' started by raj chahal, Feb 24, 2006.

  1. raj chahal

    raj chahal Guest

    Hi there

    i have created a registration page containing a form than sends username
    password to an asp processing page. If the user exists it sends the user
    back to the registration page with server.transfer command otherwise it adds
    the new user to the database as expected.

    Anyhow I now want to add an upload feature to the registration page (using
    pure-asp). The example I used says that the form Enctype property should be
    set to mulipart/form-data.

    Now when I add a new user via the registration form, the processing page for
    some reason assumes the user is already registered (BUT IS NOT IN DATABASE)
    and the server.transfer code is executed ? sending the user back to the
    registration page.

    Whats going on here ? and remedies ?

    Thanks again.
    raj chahal, Feb 24, 2006
    #1
    1. Advertising

  2. raj chahal

    Paxton Guest

    raj chahal wrote:
    > Hi there
    >
    > i have created a registration page containing a form than sends username
    > password to an asp processing page. If the user exists it sends the user
    > back to the registration page with server.transfer command otherwise it adds
    > the new user to the database as expected.
    >
    > Anyhow I now want to add an upload feature to the registration page (using
    > pure-asp). The example I used says that the form Enctype property should be
    > set to mulipart/form-data.
    >
    > Now when I add a new user via the registration form, the processing page for
    > some reason assumes the user is already registered (BUT IS NOT IN DATABASE)
    > and the server.transfer code is executed ? sending the user back to the
    > registration page.
    >
    > Whats going on here ? and remedies ?
    >
    > Thanks again.


    At a guess, it would seem that the revisions you have made to your page
    code have resulted in faulty logic. But no one here will be able to
    offer concrete help without seeing your code. Post the relevant parts
    of it so we don't have to guess.

    /P.
    Paxton, Feb 24, 2006
    #2
    1. Advertising

  3. raj chahal

    raj chahal Guest

    Hi there
    I've posted the code hope someone can help.

    Here is the code for the form :

    <%@LANGUAGE="VBSCRIPT"%>
    <html>
    <head>
    <title>Register</title>
    </head>
    <body>

    <form action="registered.asp" method="post" enctype="multipart/form-data"
    name="register">
    <table border="0">
    <tr>
    <td width="103">Username :</td>
    <td width="652"><input name="username" type="text" id="username">
    </td>
    </tr>
    <tr>
    <td>First Name : </td>
    <td width="652"><input name="firstname" type="text" id="firstname"
    value="<%=Request.Form("firstname")%>"></td>
    </tr>
    <tr>
    <td>Surname :</td>
    <td><input name="surname" type="text"
    value="<%=Request.Form("surname")%>"></td>
    </tr>
    <tr>
    <td>Password :</td>
    <td><input type="password" name="password"></td>
    </tr>
    <tr>
    <td>Email :</td>
    <td><input name="email" type="text"
    value="<%=Request.Form("email")%>"></td>
    </tr>
    <tr>
    <td><p>&nbsp;</p> </td>
    <td><br>
    </td>
    </tr>
    <tr>
    <td colspan="2"><input name="submit" type="submit"
    value="submit"></td>
    </tr>
    </table>
    </form>

    </body>
    </html>

    And here is the code for the processing :

    <html>
    <head>
    <title>Registered Routine</title>
    </head>
    <body>

    <%

    'bring forward the 4 variables:username, surname, password,email

    username=request.form("username")
    surname=request.form("surname")
    password=request.form("password")
    email=request.form("email")

    'we would now do a query to see if that registration details are unique, but
    we will cover that in a later tutorial

    'now to open up the database
    %>
    <!--#include file="connection.asp"-->
    <% ' new raj

    'do a loop and check each record for the users, when found set Check to 1
    (success)

    myquery = "SELECT username,password FROM users"

    set query=Conn.execute(myquery)
    do while not query.eof

    username2=query("username")
    password2=query("password")


    'if username and password is found in the database together then make check
    =1 ie a success

    if (username=username2) AND (password=password2) then
    'check to see if the user has activated. 0 = not activated,1 = activated

    response.write "user exists<br />"

    ' Response.Redirect("register.asp")
    Server.transfer ("register.asp")

    end if
    set conn = nothing
    query.movenext
    loop

    set query = nothing

    ' end raj
    %>

    "raj chahal" <> wrote in message
    news:%...
    > Hi there
    >
    > i have created a registration page containing a form than sends username
    > password to an asp processing page. If the user exists it sends the user
    > back to the registration page with server.transfer command otherwise it

    adds
    > the new user to the database as expected.
    >
    > Anyhow I now want to add an upload feature to the registration page (using
    > pure-asp). The example I used says that the form Enctype property should

    be
    > set to mulipart/form-data.
    >
    > Now when I add a new user via the registration form, the processing page

    for
    > some reason assumes the user is already registered (BUT IS NOT IN

    DATABASE)
    > and the server.transfer code is executed ? sending the user back to the
    > registration page.
    >
    > Whats going on here ? and remedies ?
    >
    > Thanks again.
    >
    >
    raj chahal, Feb 27, 2006
    #3
  4. raj chahal

    Paxton Guest

    raj chahal wrote:
    > Hi there
    > I've posted the code hope someone can help.
    >
    > Here is the code for the form :
    >
    > <%@LANGUAGE="VBSCRIPT"%>
    > <html>
    > <head>
    > <title>Register</title>
    > </head>
    > <body>
    >
    > <form action="registered.asp" method="post" enctype="multipart/form-data"



    You could get rid of enctype="multipart/form-data". It's preventing
    the request.form values from being passed to the processing page.
    Alternatively, if you are going to add the facility for people to
    upload files as part of this script, check the documentation for your
    upload component to see how to access them.


    >
    > 'we would now do a query to see if that registration details are unique, but
    > we will cover that in a later tutorial
    >


    !!!!??!! *cough*

    /P.
    Paxton, Feb 27, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Li Zhang
    Replies:
    4
    Views:
    6,042
    softip
    Feb 27, 2009
  2. Matt
    Replies:
    8
    Views:
    141,932
    zeeshanakhter2009
    May 26, 2012
  3. Duncan
    Replies:
    0
    Views:
    1,435
    Duncan
    Feb 24, 2006
  4. Matt
    Replies:
    1
    Views:
    11,127
    David Dorward
    Oct 12, 2004
  5. Replies:
    1
    Views:
    389
Loading...

Share This Page