I have a php code i.e
<?php
$dbServername = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "uppercase";
$con = mysqli_connect($dbServername,$dbUsername,$dbPassword,$dbName) or
die(mysqli_error());
mysqli_select_db($con,$dbName);
$sql = "SELECT * FROM urltable ;";
$result = mysqli_query($con,$sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0 ) {
while ($row = mysqli_fetch_assoc($result)){
$row['name'];
echo $row['url'];
}
}
mysqli_close($con);
?>
What I want to do is take the data stored in ($row['name']) and store it into HTML and assign some id to it.
for eg:My javascript code
chrome.tabs.getSelected(null,function(tab) {
var tablink = tab.url;
var tabtitle = tab.title;
document.getElementById("lol").value=tablink;
document.getElementById("card").value=tabtitle;
});
HTML CODE
<input type="hidden" id="lol" name="lol" value="" />
<input type="hidden" id="card" name="card" value="" />
First Name: <input type="text" name="name1">
<input type="Submit">
</form>
<form action="http://localhost/retrieve.php" method="post">
<input type="text" id="lol2" name="lol2" value="" />
<input type="Submit">
</form>
This is a part of my javascript and HTML code. I took the value of variables(tablink and tabtitle) and assigned them id's like (lol and card) into HTML.
I want to do same with my PHP variable ($row['name']) and assign it id 'lol2'. How should I do it?