0

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,^_^

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by saiprem
0

This 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>';
0

sir, the code didnt work, it displays an error "Object required."

0

My code was just a brief outline that shows the hard stuff but all you need to do is create the ajax function with the row input and to do the mysql query. I would suggest following an ajax tutorial for that bit so you can get an understanding of how it works.

0

Possibly the error "Object required." will comes if you haven't created instance for the database or if you haven't created XMLHTTPREQUEST Object.

If you haven't created Ajax object then
javascript:ajaxfunction
will not works for you.

cwarn23 has given correct code for you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.