Hello guys.
Hope you’re all keeping well.
Query for you…please.
I am using the following FAQ script that I made ages ago with some assistance, which uses a select menu and a redirect.php that transfers the user to the value url and then brings up the matching file.
Our answers are in files, i.e. 1.html in the ‘ans’ directory and they’re displayed.
What I want to do now is have an option of ‘Show all’, which would bring up every .html file and show all the answers.
How easy would that be to achieve?
Hope that makes sense!
THANKS!
code:
[code=php]
<form action=”/redirect.php” method=”post”>
<p><select name=”faqmenu”>
<option value=”” selected=”selected”>Please select a question</option>
<option value=”/faq/services.php?id=1″>1. qu 1</option>
<option value=”/faq/services.php?id=2″>2. qu 2</option>
<option value=”/faq/services.php?id=3″>3. qu 3</option>
<option value=”/faq/services.php?id=4″>4. qu 4</option>
</select> <input type=”submit” name=”submit” value=”Go” /></p>
</form>
<?php
$id = (int)$_GET[‘id’];
if ($id <= 19 && $id >= 1) {
$info = “/home/us/htdocs/faq/ans/$id.html”;
if (file_exists($info)) {
readfile($info);
} else {
echo “<p class=”error”>Sorry, that answer doesn’t exist. Please try again.</p>n”;
}
}
?>