NogDog;1232631 wrote:<?php
$categories = array(
'Biology' => 'biology',
'Chemistry' => 'chemistry',
'Christian Religious Knowledge' => 'crk', // whatever actual file name is?
'Commerce' => 'commerce' // etc....
);
if(!empty($_POST['jumpMenu']) and isset($categories[$_POST['jumpMenu']])) {
if(!empty($_POST['jumpMenu2']) and ctype_digit($_POST['jumpMenu2'])) {
$file = $categories[$_POST['jumpMenu']].'passq'.$_POST['jumpMenu2'].'.php';
if(file_exists($_SERVER['DOCUMENT_ROOT']).'passq/'.$file) {
header('Location: passq/'.$file);
exit;
}
}
}
else {
// handle errors here?
}
Thanks so much for your response. see below for some change made to the php and the HTML. But i still haven't achieved my goal.
<?php
$categories = array(
'Biology' => 'biology',
'Chemistry' => 'chemistry',
'Christian Religious Knowledge' => 'christian religious knowledge',
'Commerce' => 'commerce'
'Economics' => 'economics'
'English Language' => 'english language'
'Government' => 'government'
'Mathematics' => 'mathematics'
'Physics' => 'physics'
'Principle of Accounts' => 'principle of accounts'
'Agricultural Science' => 'Agricultural Science'
);
if(!empty($POST['jumpMenu']) and isset($categories[$POST['jumpMenu']])) {
if(!empty($POST['jumpMenu2']) and ctype_digit($POST['jumpMenu2'])) {
$file = $categories[$POST['jumpMenu']].'passq'.$POST['jumpMenu2'].'.php';
if(file_exists($_SERVER['DOCUMENT_ROOT']).'passq/'.$file) {
header('Location: passq/'.$file);
exit;
}
}
}
else {
// handle errors here?
}
HTML
<body>
<form id="form1" name="form1" method="post" action="redirect.php">
<div align="center">
<p><img src="Untitled-7.png" width="862" height="194" /> </p>
<table width="866" height="81" border="0" cellpadding="5" bgcolor="#CC3300">
<tr>
<th colspan="3" bgcolor="#F0F0F0" scope="col"><ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="index.php">Home</a> </li>
<li><a href="thepassutme.php">The Pass</a></li>
<li><a href="#">Universities</a> </li>
<li><a href="#">Books</a></li>
<li><a href="Contact.php">Contact</a></li>
</ul> </th>
</tr>
<tr>
<th colspan="3" scope="row"><label></label></label>
<div align="center"></div>
<label></label></th>
</tr>
<tr>
<td colspan="3" scope="row"><div align="center">
<table width="398" height="235" border="3" cellspacing="3" bordercolor="#990000" bgcolor="#00FF00">
<tr>
<td><div align="center">
<table width="200" border="0">
<tr>
<td><select name="jumpMenu" id="jumpMenu">
<option selected="selected">Select Subject</option>
<option value="Biology">Biology</option>
<option value="Chemistry">Chemistry</option>
<option value="Christian Religious Knowledge">Christian Religious Knowledge</option>
<option value="Commerce">Commerce</option>
<option value="Economics">Economics</option>
<option value="English Language">English Language</option>
<option value="Government">Government</option>
<option value="Mathematics">Mathematics</option>
<option value="Physics">Physics</option>
<option value="Principle of Accounts">Principle of Accounts</option>
<option value="Agricultural Science">Agricultural Science</option>
</select>
<div align="center">
<label></label>
</div></td>
<td> </td>
<td><select name="jumpMenu2" id="jumpMenu2">
<option selected="selected">Select Year</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="20010">2010</option>
<option value="20011">2011</option>
<option value="20012">2012</option>
</select></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<label></label>
<p> </p>
<p> </p>
</div></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<label></label>
<input type="submit" name="button" id="button" value="Search" />
</div></td>
</tr>
please i will be grateful if you can take more time to see me through this.