Firstly, sorry for my bad English (I'm Italian).
Anyway, I'm making a web-site project for school, so I'm using HTML, CSS and PHP languages.
I'd like to put a sort of button-link (for example the "Like" one, as in Facebook) but how can I do it?
In Facebook, when I click on "Like", I won't be redirected to another page, so it can't be something like:
<a href="like.php">Like</a>
In fact, I want the user to be in the same page at the same position
I thought I could write something like this (I'll call this file home.php):
<a name="5">
<a href="like.php?position=5&user=Paul>Like</a>
So, I will write in PHP something like:
<?php
// Database connection
// Adding a like in database. The user who liked the object is in $_GET['user']
// ...
header("location:home.php#$_GET[position]");
?>
But I don't want the user to be redirected to a page call like.php which redirect, in turn, the user at the beginning page...
How can I do it? And how can I connect to database?
Thanks in advance ^^