hi guys, just wanna ask, is it possible to have a function using tables in html wherein if a user selects a row, the program will get the value of the entire selected row? and this value will be passed to php without reloading the page itself..thanks thanks in advance,^_^
xuexue 15 Junior Poster
Recommended Answers
Jump to PostYes, all you need to do is give each row a unique id (eg number) and use ajax to make the php request.
Jump to PostThis is a brief code...
echo '<table border=1 cellpadding=5 cellspacing=0>'; for ($i=0;$row=mysql_fetch_assoc($sql_result);$i++) { echo '<tr id="'.$i.'">'; echo '<td>'.$row['column1'].'</td>'; echo '<td>'.$row['column2'].'</td>'; echo '<td><a href=# onclick="javascript:ajaxfunction(\''.$i.'\');">Send</a></td>'; } echo '</table>';
All 6 Replies
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
xuexue 15 Junior Poster
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
xuexue 15 Junior Poster
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
saiprem 4 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.