Advanced Search

Results 1 to 3 of 3

Thread: grabbing a <td class="value"> with java script to a form located on another website..

  1. #1
    Join Date
    Nov 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default grabbing a <td class="value"> with java script to a form located on another website..

    In need of some help. I need to grab a value in the table below, and pre load it into a form on another website. I need to make a form action, that on click will take the value of <td class="carbon"> and drop that value into a form on another website labled "custom_qty"

    <table id="summary_totals">
    <tbody>
    <tr class="totals">
    <td class="total_label">Your Totals</td>
    <td class="money"> $-21850.00 / $385.53 </td>
    <td class="time"> 0 hrs / 0 hrs</td>
    <td class="carbon">4544 tons / 2285 tons</td>
    </tr>

    Let's use http://www.website.com/index.html (placeholder) as the page that contains the final resting spot for the form "custom_qty"

    Anyone know how I can do this? if you could help me in writing a form to do so I would be very thankfull!

    -Joel

  2. #2
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Wouldn't it be browser security violation (cross-site scripting)?

    perhaps you can resort to iframe

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Server-side is your best option, using PHP in this case. What I'll be doing is storing the data in a variable and sending it to another PHP page which recieves the variable contents. It's fairly simple.
    Give your carbon td a "name" attribute:
    Code:
    <td class="carbon" name="carbonData">4544 tons / 2285 tons</td>
    Now before we go into the next part, I'm assuming you are using a form outside your table:
    Code:
    <form action="newpage.php" method="post">
    <table id="summary_totals">
    <tbody>
    <tr class="totals">
    <td class="total_label">Your Totals</td>
    <td class="money"> $-21850.00 / $385.53 </td>
    <td class="time"> 0 hrs / 0 hrs</td>
    <td class="carbon">4544 tons / 2285 tons</td>
    </tr>
    </table>
    <input type="submit" value="Go to page">
    </form>
    The above button in red will send you to your result page.

    When you go to your result page (in this case newpage.php), make these adjustments:
    Code:
    <td class="custom_qty"><?php
    $dat = $_POST["carbonData"];
    echo $dat;
    ?></td>
    Hopefully this helps
    - Mike

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
  •