Been trying this for ages :(
Upon registering, each user gets a randomly generated number which is stored in a table called "hash".
After much turmoil I have set up phpmailer and got the whole email process working, all fine, no worries.
BUT I have encountered a problem and I have even read answers on this site that haven't helped. I simply want to create a unique activation link depending on the hash. So for example:
User with "hash" as "12345" gets their verification email, I want the hyperlink to look like this - www.example.com/verify.php?hash=12345
And the same for each other user, here's how I'm currently trying it
<?php
$link_address = "verify.php?hash='.$hash.'";
echo "<a href='$link_address'> Activate </a>";
?>
This displays "Activate "; ?>"
Very weird :(
EDIT
This is the guide I've previously tried to copy from - http://code.tutsplus.com/tutorials/how-to-implement-email-verification-for-new-members--net-3824
It is outdated and the default mail() function doesn't work for what I want, I'm particularly up to Step 5
EDIT 2
Mail body generation code
$body = file_get_contents('C:\wamp\www\Game\examples\contents.html');
BIG EDIT!!
New code:
<?php
include("connect.php");
$username = $_POST['username'];
$id_get = mysqli_query($con,"SELECT units.id, users.id, users.username FROM units, users WHERE users.username = '$username' AND units.id = users.id");
$gotid = mysqli_fetch_array($id_get);
$id4 = $gotid["id"];
$stuff_get = mysqli_query($con,"SELECT users.id, users.email, users.hash, users.username FROM users WHERE users.username = '$username' AND users.id=$id4");
$gotstuff = mysqli_fetch_array($stuff_get);
$hash2 = $gotstuff['hash'];
$email2 = $gotstuff['email'];
$username2 = $gotstuff['username'];
echo "Your username is ",$username2,"<br>";
echo "Your activation code is ",$hash2,"<br>";
?>
From there I'm trying to get the submitted username (from the registration) and get information from the database (IDs, emails etc) then simply display the username and the hash in the email.
Usually this would be super easy but I'm getting the good old "Notice: Undefined index: username"!!
EDIT
For a completely simple run down on the situation.
I want to be able to get one variable from a page to another page for example.
page1.php
Has a variable called "$users"
page2.php
Wants to echo $users
But I do not know how to make the variable $users specifically from page1.php available on page2.php!