Here's what my DB looks like:
link_id | DEPARTMENT_NAME | SHORTENED_NAME
1 | ART | ART
2 | COMPUTER SCIENCE | CSCI
3 | BIOLOGY | BISC
Link_id is my PK.
here is my page from a combo box (index2.php) :
<?
include("db.php");
?>
<FORM ACTION="jump.php">
<SELECT NAME="link_id">
<?
MYSQL_CONNECT(HOST,USER,PASS) OR DIE("Unable to connect to database");
@mysql_select_db(DB) or die( "Unable to select database");
$query=("select * from departments order by DEPARTMENT_NAME, DEPARTMENT_NAME desc");
$result=mysql_query($query) or die ("Unable to Make the Query:" . mysql_error() );
while($row=mysql_fetch_array($result)){
echo "<OPTION VALUE=".$row['SHORTENED_NAME'].">".$row['DEPARTMENT_NAME']."</OPTION>";
}
?>
</SELECT>
<INPUT TYPE="submit" VALUE="Jump!" />
</FORM>
Here is my jump page (jump.php):
<?php
include("db.php"); // this should include the CONNECT and BD SELECT
$query = "SELECT url FROM link WHERE link_id = '$link_id';
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$newloc = $myrow["url"];
mysql_free_result($result);
header(Location: $newloc);
?>
When you click on the box, it should display a record such as
3 | BIOLOGY | BISC
If you want to take a gander at the page, it's
http://www.pooka.mine.nu/bookstore/secret2/index2.php
Thanks for helping and thanks for telling me that the tutorial sucked! I tried looking for it all over the net! If you found a better tutorial please show me.
Thanks and I am a NOOB,
T