dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Converting javascript data do php

  1. #1
    Join Date
    Aug 2010
    Posts
    1

    Post Converting javascript data do php

    hi all... i'm trying to use a vector that is returned from a javascript datatable to a php session variable.. i've got the following code:


    <script type="text/javascript" charset="utf-8">

    function fnFormatDetails ( oTable, nTr )
    {
    var aData = oTable.fnGetData( nTr );
    var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
    sOut += '<tr><td><br>Email:'+aData[3]+'<br>Contact: '+aData[4]+'<br></td><td></td></tr>';
    sOut += '<tr><td><a href=showcompany.php">Consultcomp</a><?$_SESSION['id']= $aData[0]?></td></td></tr>';
    //sOut += '<tr><td>Extra info:</td><td>And any further details here (images etc)</td></tr>';
    sOut += '</table>';

    return sOut;
    }


    i know that i cant simply convert directly a javascript structure to php.. i just wrote the code in red to explain what i'm trying to do... i need to pass the id from the row in datatable to use on php code on the showcompany.php

    i hope that you understand my question.
    thanks..

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    One way is to write javascript code to append a query string (containing the name/value pair for the data you want to send) to showcompany.php

  3. #3
    Join Date
    Aug 2010
    Posts
    3
    I've used JavaScript to change the value of a hidden variable that then must be submitted.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles