This may sound confusing, but I am unsure as where to start looking for an answer. This is the scenario: I have a webpage with a table created using PHP and inside each cell is a randomly selected word. What I would like to do is allow a user to click one of the cells and it would return the definition of the word, and refresh the table/page. From what I found so far was to make use of _POST/_REQUEST, however I am unsure how to find out what the user clicked, and pass that into a function to find the definition. Is my logic correct here, how would you go about this? I was thinking of having an onclick function to identify the element clicked, but don't know how to handle it.
<body>
<form method="post" action="
<table border="1">
<?php
$f="/words.txt"; //definitions also included in this file
$o=file($f);
$len=count($o);
$i=0;
while( $i < 18){
$rnum= rand(2,$len);
$rword= $o[$rnum];
$piece= explode(" ",$rword); //get just the word on the line
if($i%3==0){
echo "<tr>";
}
echo "<td id='$i' onclick='about()'>".$piece[2]."</td>";
$i++;
if($i%3==0){
echo "</tr>";
}
}
?>
</table>
</body>
</html>