1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting the button's value

Discussion in 'Web Design, HTML And CSS' started by rag84dec, Feb 6, 2008.

  1. rag84dec

    rag84dec New Member

    Joined:
    Jul 17, 2007
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    hi,
    I have the following code to get the button's value..It is giving empty string....
    Can anyone help in getting the value of type button

    Code:
    <form name='rag' action='tt.asp' method='post'>
    <input type=text name='ra'/>
    <input  type='button' value='Saks' name='Slskdfh' />
    <input type='submit' value='OK' name='submit'/>
    </form>
    
    
    tt.asp contains
    Code:
    <html>
    
    <%
    response.write request.form("Slskdfh")
    
    response.write request.form("ra")
    %></html>
    

    i want to get "Saks"
     
    Last edited: Feb 6, 2008
  2. rag84dec

    rag84dec New Member

    Joined:
    Jul 17, 2007
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    to make it more clear


    i do not want to submit for the "button" with the name "buttonname"...For some reason i want that button's value...once i submit i shud get "buttonvalue"...wat is wrong with my code???



    Code:
    <form name='rag' action='tt.asp' method='post'>
    <input  type='button' value='butonvalue' name='buttonname' />
    <input type='submit' value='OK' name='submit'/>
    </form>
    
    

    tt.asp has this
    Code:
    <%
    response.write request.form("buttonname")
    
    %>
    
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    In case of a button the value is sent over only if it is clicked, so if you want some value to be posted with your form, use :
    HTML:
    <input type="hidden" name="nm" value="val">
    
     

Share This Page