I was wondering how I would be able to create a button that would be related to the information in that row.
So far I have an array that contains a person’s first name, last name, and phone number. I would also like to create a button, so when the user clicks that the information of the person is carried to the next PHP page.
Should I be creating a form each time I create a row in the array?
So far I have:
foreach($array as $row)
{
echo (
"<tr>".
"<td>".$row['last_name']. "</td>".
"<td>".$row['first_name']. "</td>".
"<td>".$row['phone_no']. "</td>".
"<td>".$row['date_of_birth']. "</td>".
"<td>".$row['membership']. "</td>".
"<td><Button>Reserve</Button></td>".
"</tr></table>");
}
The reason it is being echoed is because I am using it in an ajax function and wish to output the result that way.
Any suggestions?
You can use the new HTML5 data attribute for this:
You can then use javascript, or more specifically jQuery’s .data() functionality to get this data value
Edit
Then the Javascript