I was wondering if anyone can help me out? I am trying to do pass variables from one page to another. I know how to pass one variable but I need to send more then one by clicking a link. Here is a bit of my code with the rows i would like to send to the next page. If you need the full code i can post it. Thanks.
echo '<tr>';
echo '<td bgcolor="#f8f8f8" width="240"><font size="2">'.htmlentities($row['subject'], ENT_QUOTES, 'UTF-8').'</font></td>';
echo '<td bgcolor="#f8f8f8" width="10"><font size="2">'.htmlentities($row['priority'], ENT_QUOTES, 'UTF-8').'</font></td>';
echo '<td bgcolor="#f8f8f8" width="110"><font size="2">'.htmlentities($row['date'], ENT_QUOTES, 'UTF-8').'</font></td>';
echo '<td bgcolor="#f8f8f8" width="40"><font size="2">'.htmlentities($row['status'], ENT_QUOTES, 'UTF-8').'</font></td>';
echo '<td align="center" bgcolor="#f8f8f8" width="16"><a href="viewreply.php?id=' . $row['id'] . '"><img src="images/view.png" width="16" height="16"></a></td>';
echo '</tr>';
this is what i have for page 2
<?php
require("../db.php");
if(empty($_SESSION['user'])){
header("Location: ../login.php");
die("Redirecting to ../login.php");
}
$query = "SELECT id, subject, priority, date, status FROM newsupportticketsadmin WHERE username = :username And id= :id";
$query_params = array(
':id' => $_GET['id'],
':subject' => $_GET['subject'],
':priority' => $_GET['priority'],
':date' => $_GET['date'],
':status' => $_GET['status'],
':username' => $_SESSION['user']['username']
);
echo $_GET['id'];
echo $_GET['subject'];
echo $_GET['priority'];
echo $_GET['date'];
echo $_GET['status'];
Your current link is like this:
<a href="viewreply.php?id=' . $row['id'] . '">
If you want to send multiple values, it would look like this:
<a href="viewreply.php?id=' . $row['id'] . '&subject=' . $row['subject'] . '">
You can add multiple parameters, you just need to separate each key/value pair with an ampersand.
In this particular case you don't need to pass more than one variable.
As there is absolutely no point in passing a variable which you have on the other page already.
Especially as you have fantastically inconsistent code for SQL query.
$query = "SELECT id, subject, priority, date, status FROM newsupportticketsadmin
WHERE username = :username And id= :id";
$query_params = array(
':id' => $_GET['id'],
':username' => $_SESSION['user']['username']
);
it have to be.
And no subject have to be passed via hyperlink but have to be fetched from database.