show mysql result into html table on new window
I have this main page with text and button.
On click of the textbox, it should open a new window and show there html table populated with mysql records and on each row has a button that when I click on it, the value of the text on the main page is the some value on the row where I clicked the button.
I have already googled and checkout youtube samples but no result what I am looking.
I am a self learning on this and just started reading today about javascript and jquery so I dont fully grasp all the
information yet.
I rely on the help about this from the rest of the forum members. Please kindly bear with me asking for help.
Thanks in advance.
Re: show mysql result into html table on new window
PHP Code:
<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Persons");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>