Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Getting Info from a Form to a table... NEED HELP!

    I am a newbe to web delevlopment.
    I have the following form:
    <form name="quantityconnect" method="get" action="http://www.doc.ic.ac.uk/~gu1/cgi-bin/formnew1.cgi ">

    Quantity:
    <select name="Quantity" size="1">
    <option value="1">...1...</option>
    <option value="2">...2...</option>
    <option value="3">...3...</option>
    <option value="4">...4...</option>
    <option value="5">...5...</option>
    <option value="6">...6...</option>
    </select>

    <input type="submit" value="Add to my basket">

    </form>

    What I want is for when the "Add to my basket" button is clicked, is for the value selected from the drop down box to be inputted into this table:

    <table id="shoppingcart border="1">
    <tr bgcolor="#ff0000">
    <th align="center"><b>Item</b></th>
    <th align="center"><b>Quantity</b></th>
    <th align="center"><b>Price</b></th>
    <th align="center"><b>Sum</b></th>
    </tr>
    <tr cellpadding="5">
    <td><p><img src="20questionsbasket.jpg" alt="20questions" title="20 Questions">20 Questions Electronic Mind Reader</p></td>
    <td>QUANTITY INSERTED HERE</td>
    <td>9.77</td>
    <td></td>
    </tr>
    <tr>
    </table>

    I have experimented many different ways unsuccessfully, and am now assuming i need to use some sort of javascript... Any1 have any code to help?

    Thanks
    Mike

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    What I want is for when the "Add to my basket" button is clicked, is for the value selected from the drop down box to be inputted into this table:
    Don't you need to save the selected data in your DB/session Or just need to add that string to your table cell from the client side?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Don't you need to save the selected data in your DB/session Or just need to add that string to your table cell from the client side?
    Just adding the string client side that section of the table...
    Also if possible, for that section of the table to display '...0...'(zero) by default.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    <select name="Quantity" size="1" id="Quantity">
    <option value="1">...1...</option>
    <option value="2">...2...</option>
    <option value="3">...3...</option>
    <option value="4">...4...</option>
    <option value="5">...5...</option>
    <option value="6">...6...</option>
    </select>
    Code:
    <td id="targetcell">QUANTITY INSERTED HERE</td>
    You may call the following function in the onclick of your button,
    Code:
    function add(){ document.getElementById('targetcell').innerHTML='...'+document.getElementById('Quantity').value+'...';
    }
    Also if possible, for that section of the table to display '...0...'(zero) by default.
    Can't you just write it there?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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