This is the scenario:
User A: Access the website and choose a questionnaire. The questionnaires are separated on different pages in the same domain, for example:
After choosing one, he (User A) puts the following information:
1 = Recipient's email
2 = His email
And then submit.
User B: Person who received this link to the questionnaire (surveys.com/type1).
What I want to do is: When User B accesses the link to the questionnaire page, it is already programmed to send responses to User A who left his email on the home page.
My idea was to save the information provided by User A in variables and save it in the database. When User B accesses the page, I take the respective information from the database and use it on the page to do what I want.
The problem is: How would I separate information for different users? (maybe it's simple, but I don't know how to do it)
That's what I've done so far:
<?php include_once 'includes/dbh.php'; require 'email/PHPMailerAutoload.php'; $recipient = $_POST['emailFor']; $sender = $_POST['senderEmail']; $message = $_POST['message']; $sql = "INSERT INTO users(email, body) VALUES('$sender', '$message');"; mysqli_query($conn, $sql;)
Questionnaire page (survey.com/type1):
<?php include_once 'includes/dbh.php'; $sql = "SELECT * FROM users;"; $result = mysqli_query($conn, $sql); ?>
I think it is not possible to use sessions, since the information will need to be passed on to another user. I also thought about the possibility of creating a uniq link maybe, but I have no idea how to do it. Anyway, I'll be grateful if you can help with code examples for this.