Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 04, 2016, 02:16:24 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Dreamweaver, dynamic drop down menu  (Read 4763 times)

kevstero

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 16
    • View Profile
    • Donate to Member
Dreamweaver, dynamic drop down menu
« on: June 24, 2008, 10:30:19 PM »
Hi. Here's my problem.

I have two tables. One is a main category table and the other is a subcategory table.

The main category table has the fields (catID and catName)

The Subcategory table has the fields (catId, SubId and SubName)

The two are related via the catId field..

I can't figure out how to dynamically load the second drop down menu from the choice made in the first drop down menu.. If anybody can point out whats wrong, it would be nice Thanks.




<?php require_once('Connections/antiques.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_antiques, $antiques);
$query_Recordset1 = "SELECT items.ItemId, items.BuyingPrice, items.SellingPrice FROM items";
$Recordset1 = mysql_query($query_Recordset1, $antiques) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...ml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <label></label>
  <select name="choosemenu" id="choosemenu" title="<?php echo $_POST['ChooseMenu']; ?>" onchange="MM_jumpMenu('parent',this,0)">
    <option value="">Choose Antique Type</option>
    <?php
do { 
?>
    <option value="<?php echo $row_Recordset1['ItemId']?>"><?php echo $row_Recordset1['ItemId']?></option>
    <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
     $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
          </select>
  <label>
  <input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
« Last Edit: June 26, 2008, 09:02:16 PM by kevstero »

kevstero

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 16
    • View Profile
    • Donate to Member
Re: Dreamweaver, dynamic drop down menu
« Reply #1 on: June 26, 2008, 01:47:14 PM »
Please, somebody.....

kevstero

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 16
    • View Profile
    • Donate to Member
Re: Dreamweaver, dynamic drop down menu
« Reply #2 on: June 27, 2008, 11:00:23 AM »
I got the drop down menus working because I got dreamweaver developer toolbox...

Now I just need to send me results form the second drop down menu to another page after the user clicks submit..

It's no problem to send the actual SubID to be displayed (the value for the item chosen in the second drop down menu), but I want to display all fields with that same SubID, along with their corresponding fields.. Does that make sense?

If anybody could help give an idea as how to go about doing this, I'd appreciate it.. Maybe even pay $$