0

So i have a question that might seems easy to fix some some of you guys, but i can't seem to do it. I have a PHP file with this inside:

$bang .= "<td><a href='".$_SERVER['PHP_SELF']."?id=".$row['userId']."'>test</a></td>";
$bang .= "<td><i class=\"fas fa-cog\" onclick='getandupdateuser();'></i></td>";

now i want to use the $row['userId] in the getandupdateuser() function below. problem is, i cant pass the userid into some script to var it first and then use it. since its in a while loop. and i need it to work for multiple $bang items.

so how do i pass my $row result into the script below?

Ramon de Vries
  • 1,312
  • 7
  • 20

1 Answers1

2

Change

$bang .= "<td><i class=\"fas fa-cog\" onclick='getandupdateuser();'></i></td>";

to

$bang .= "<td><i class=\"fas fa-cog\" onclick='getandupdateuser(" . $row['userId'] . ");'></i></td>";
Dave
  • 5,108
  • 16
  • 30
  • 40