Hello Suzzane,
You probably do not need to redirect to another page. I am assuming that links are seperated by a semicolon and each link is a well formed html just like the page body. If these assumptions are corret then you can alter your page as shown below.
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include_once("db_connects.php");
if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") {
$searchquery = preg_replace('#[^a-z 0-9?!]#i', '', $_POST['searchquery']);
$sqlCommand = "(SELECT id, links, page_body, page_title AS title FROM pages WHERE MATCH(page_title,page_body) AGAINST ('$searchquery'))";
$result = mysql_query($sqlCommand) or die(mysql_error());
$row = mysql_fetch_row($result);
if ($row) {?<
<html>
<head>
<title><?=$row[3]?></title>
<?php
$links = exlpode(';', $row[1]);
foreach ($array as $i => $links) {
echo $links[$i];
}?>
</head>
<body><?=$row[2]?></body>
</html>
<?php
}
mysql_free_result($result);
}
Regards,