Jump to content

mantsali

New Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mantsali

  • Rank
    Newbie
  1. wow thanks its working, just needed the external script. You were right
  2. escape all values? but thats the part that is working, here is the sample code ive been working with <!DOCTYPE HTML> <html> <head> <script> $(function () { $('#track-link').click(function () { alert('holla'); alert('This is the track: ' + $(this).data('track')); }); }); </script> </head> <body> <?php $con=mysqli_connect("localhost","root","","mnjush"); $result = mysqli_query($con,"SELECT * FROM music"); while($row = mysqli_fetch_array($result)) { echo $row['artist'] ; ?> <a id="track-link" href="<?php echo $row['trackLoc']; ?>" download="<?php echo $row['trackLoc']; ?>" data-track="<?= htmlspecialchars($row['trackLoc'], ENT_QUOTES, 'UTF-8') ?>">Download</a> <?php echo "<br>"; } mysqli_close($con); ?> </body> </html>
  3. this is what my link looks like <a id="track-link" href="<?php echo $row['trackLoc']; ?>" download="<?php echo $row['trackLoc']; ?>" data-track="<?= htmlspecialchars($row['trackLoc'], ENT_QUOTES, 'UTF-8') ?>">Download</a> the track does download but thats all that happens
  4. tried all your examples and the javascript function is never called. the issue is, i have to download the track and send the track to a different page and im retrieving the track name from a mysql database.
  5. Help I am trying to pass a php variable into a javasript function. Here is my code. <a href="<?php echo $row['track']; ?>" download="<?php echo $row['track']; ?>" onclick="myhit(<?php echo $row['track']; ?>)">Download</a> <script> function myhit(top){ alert(top); } </script> the javascript function is never called
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.