Shiela
Shiela

Reputation: 691

Create a JS Pop-Up to a link with a Data from Database

I have here my href link being echoed:

echo "<td><a href='../php/borrowersname.php?acc_number=".$row['acc_number']."'>".$row['title']."</a></td>";

And I have here a sample on how to create a Pop-Up:

<a href="javascript:window.open('some.html', 'yourWindowName', 'width=200,height=150');">Test</a>

How to combine this to my href link above being echoed with the "javascript ... ..." enclosed by ("" && '')?

Thanks for another new learning.

Upvotes: 1

Views: 87

Answers (1)

user2365865
user2365865

Reputation:

You can escape the ""

<?php
    echo "<a href=\"javascript:window.open('../php/borrowersname.php?acc_number=".$row['acc_n‌​umber']."', 'yourWindowName', 'width=200,height=150');\">Test</a>";
?>

In the 'borrowersname.php' page, you can get the value of 'acc_number' like this:

<?php
    $value = $_GET['acc_number'];
    //do something with $value;
?>

Upvotes: 1

Related Questions