/    Sign up×
Community /Pin to ProfileBookmark

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><?[COLOR=”Red”]$_SESSION[‘id’]= $aData[0][/COLOR]?></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..

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@tirnaAug 24.2010 — 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
Copy linkTweet thisAlerts:
@sammysounderAug 25.2010 — I've used JavaScript to change the value of a hidden variable that then must be submitted.
×

Success!

Help @corvax spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...