How to get values of a href and post it in mysql? For instance, I have this:
<a href="test/test.doc" name="test">testing</a>
How can i get the "test/test.doc"
via php or javascript and put it in mysql table?
Many thanks.
below is my script:
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$('.linktest').click(function(){
var linkhref=$('a',this).attr('href');
$.post("testing.php", { href: linkhref } );
});
});
</script>
My html:
<p><a href="test/test.doc" class="linktest" name="test">test insert</a></p>
Here's my test.php:
if(empty($_POST['name']) || empty($_POST['href']) )
{
$sql="INSERT INTO increment (name, href, count) VALUES ('$name','$href','$count' )";
$result=mysql_query($sql,$db);
$row=mysql_fetch_array($result);
$count=$row['count'];
$count+=1;
}