SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    kuala lumpur in malaysia
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help on asp code

    hi, i am new to asp and i need help on this piece of code....

    <form method="post" action="save.asp?question_id=1" onSubmit = "return validate(this)">
    <%
    .....
    .....
    .....
    %>
    </form>

    can i pass a variable through action? what i mean is, i want to change the value of the question_id, which is 1 here to a variable.... can i do that?

    thanks.
    Helping you to get Certified!
    www.certifyexpress.com
    Ultimate Practice Exam!
    www.certifypro.com

  2. #2
    SitePoint Guru
    Join Date
    Dec 2000
    Location
    Karachi, Pakistan
    Posts
    913
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think so you can..

    and to request that variable on the save.asp page..
    you can do this.


    id=request.querystring("question_id")

    may be I am wrong as I aint getting time to do practice on asp.
    may be I would be starting it from today only.



    if I am wrong, please some one correct me.


    Thanks,
    36Host.com - $36/year web hosting [affiliates earn 30%]
    * Affordable Small Business Web Hosting since 2003! *
    "500mb space, 10gb bandwith, 50 pop/ftp accounts, php,
    mysql, pre-installed php scripts, 24/7 support & more...."



  3. #3
    SitePoint Member
    Join Date
    Jun 2001
    Location
    kuala lumpur in malaysia
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    something like this....

    <form method="post" action="save.asp?question_id=" & variable_name onSubmit = "return validate(this)">

    please correct me, if i am wrong.....

    thanks.
    Helping you to get Certified!
    www.certifyexpress.com
    Ultimate Practice Exam!
    www.certifypro.com

  4. #4
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Newcastle, England
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't make it an actual variable, but you can pass through the value of a variable in your page. Before you write out the line

    Code:
    <form method="post" action="save.asp?question_id=1" onSubmit = "return validate(this)">
    , somewhere above it on the page, you need to decide what value you want to pass through (it's up to you how you do this of course). Assume you have this value stored in a variable called id. Then you'd simply rewrite that line above to be

    Code:
    <form method="post" action="save.asp?question_id=<% = id %>" onSubmit = "return validate(this)">
    Hope that makes sense (and I hope it's what you're asking, I'm still half asleep ). If not please post again and I'll have another try .

  5. #5
    SitePoint Member
    Join Date
    Jun 2001
    Location
    kuala lumpur in malaysia
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for helping me in this piece of code..... the program works fine now..... thank you....

    take care.
    Helping you to get Certified!
    www.certifyexpress.com
    Ultimate Practice Exam!
    www.certifypro.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •