SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Submit data

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submit data

    Usually I use ASP to send data. But can I send data using JavaScript ?
    Example :

    <input type=text name=a1>A1
    ...
    <input type=text name=a6>A6

    I want to send the value (a1,...a6) to other homepage (not mine). Is it possible ?

  2. #2
    Spam Can Kill!!! Disk-t's Avatar
    Join Date
    Jul 2001
    Location
    n/a
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This requires a server side language such as PHP or ASP. JavaScript is client side.

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This page has nothing to do with server. So I want make it as client-side scripting (check only data with value will be send to other homepage).

  4. #4
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wouldn't a <form> just work? It sends the data in a query string.

    aDog

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe I'll try to explain what I want to accomplish.
    In my page I have a form
    <form name="applyform" method="post" action="???" onsubmit="return checkdata(applyform);">
    <input type=text name=a1>A1
    <input type=text name=a2>A2
    <input type=text name=a3>A3
    <input type=submit value=submit name=submit>
    </form>

    First I want to check (checkdata(applyform)), only input with value that will be send to other website (action=???). But not only the value, I want to add some parameter. Example : A1=5, A3=2; will be send as
    http://www.otherpage.com/cart.html?product[a1001]=5&product[a3001]=2

    Thanks for anyhelp

  6. #6
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you use a hidden form element?

    <input type="hidden" name="variableToPass" value="valueOfVariable">

    aDog

  7. #7
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Jakarta
    Posts
    156
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have to check the input first. Only input with value will be send. If i use hidden form element, how can I check the value and write the parameter ?


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
  •