Jump to content

ams53

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ams53's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've got my dynamic drop down menu working. However, I need help get the results page linked properly. When the final drop down menu is selected, the form sends you to the correct page (i.e. product.php?product_id=), but the url parameter is always = 4. Basically the same page pops up no matter what is selected in the final drop down. Here is the code: <?php require_once('Connections/connUser.php'); //database connection /////////////////////////////////////////////////////////// mysql_select_db($database_connUser, $connUser); $query = "SELECT * FROM manufacturers ORDER BY manufacturers.manufacturer_name"; $result = @mysql_query($query) or die(mysql_error()); $rowMan = mysql_fetch_array($result); //////////////////////////////////////////////////////////// //////////////// Set Variables to Dummy if not Set////////// if (!isset($_POST['manufacturer'])) { $_POST['manufacturer'] = "undefine"; } if (!isset($_POST['type'])) { $_POST['type'] = "undefine"; } if (!isset($_POST['name'])) { $_POST['name'] = "undefine"; } if (!isset($_GET['model'])) { $_GET['model'] = "undefine"; } ////////////////////End Setting Dummies/////////////////////// $manufacturer = $_POST['manufacturer']; $type = $_POST['type']; $name = $_POST['name']; $product_id = $_GET['model']; if (isset($manufacturer)){ //////////////////////////////////////////////////////////// $query_man = sprintf("SELECT * FROM product_type WHERE manufacturer_id='$manufacturer' ORDER BY product_type.type"); $result_man = @mysql_query($query_man); $rowType = mysql_fetch_array($result_man); //////////////////////////////////////////////////////////// } if (isset($type)){ //////////////////////////////////////////////////////////// $query_type = sprintf("SELECT * FROM product_name WHERE type_id='$type' ORDER BY product_name.name"); $result_type = @mysql_query($query_type); $rowName = mysql_fetch_array($result_type); //////////////////////////////////////////////////////////// } if (isset($name)){ //////////////////////////////////////////////////////////// $query_name = sprintf("SELECT * FROM product WHERE name_id='$name' ORDER BY product.model_name"); $result_name = @mysql_query($query_name); $rowModel = mysql_fetch_array($result_name); //////////////////////////////////////////////////////////// } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <form id="form1" form name="form1" method="post" action="dropdown.php"> <select name="manufacturer" onChange="document.forms[0].submit()"> <option value="">Select Manufacturer</option> <?php do { ?> <option value="<?php echo $rowMan['manufacturer_id']; ?>"<?php if (!(strcmp($rowMan['manufacturer_id'], $manufacturer))) {echo "SELECTED";} ?>><?php echo $rowMan['manufacturer_name']; ?></option> <?php }while ($rowMan = mysql_fetch_array($result)); ?> </select> <select name="type" onChange="document.forms[0].submit()"> <option value="">Select Product Type</option> <?php do { ?> <option value="<?php echo $rowType['type_id']; ?>"<?php if (!(strcmp($rowType['type_id'], $type))) {echo "SELECTED";} ?>><?php echo $rowType['type']; ?></option> <?php }while ($rowType = mysql_fetch_array($result_man)); ?> </select> <select name="name" onChange="document.forms[0].submit()"> <option value="">Select Product Name</option> <?php do { ?> <option value="<?php echo $rowName['name_id']; ?>"<?php if (!(strcmp($rowName['name_id'], $name))) {echo "SELECTED";} ?>><?php echo $rowName['name']; ?></option> <?php }while ($rowName = mysql_fetch_array($result_type)); ?> </select> <select name="model" onChange="document.location.href='product.php?product_id=<?php echo $rowModel['product_id']?>'"> <option value="">Select Model Number</option> <?php do { ?> <option value="<?php echo $rowModel['product_id']; ?>"<?php if (!(strcmp($rowModel['product_id'], $product_id))) {echo "SELECTED";} ?>><?php echo $rowModel['model_name']; ?></option> <?php }while ($rowModel = mysql_fetch_array($result_name)); ?> </select> </form> </body> </html> Any Suggestions??
  2. Beuller... Beuller... Anyone... Anyone.... I never thought I would have to post a rely to my own question in order to get some attention. I guess no one knows how to do this. At least I don't. Any help would be great.
  3. I've created a form with 4 dependant drop down menus used to filter available products down to product model number in the last drop down where value=product_id and label=model_name. However, I can't get the "product_id" associated with the last drop down to populate in the url parameter. For example, i've tried using the javascript statement for the submit button as: onClick="document.location.href=product.php?product_id=<? php echo [$rowRecordset4('product_id')]; ?>" Each of the drop downs is populated by a separate table, but the onClick statement calls the same page everytime. I can't get the "product_id" select from the last drop down to echo into the onClick statement. Is there a simple way to fix this? What have I missed? I am new to this, so any help would be appreciated. Thanks.
  4. I've created filtered lists with DW MX 2004 and an extension by Interakt called MX Kollection (no longer supported, since Adobe bought Macromedia). If you look around the net, you maybe able to find a free 30 day trial download, which is fully functional. MX Kollection has tutorials included that show you how to use the extension step-by-step. Part of the extension is NexTenso, which creates both filtered lists and forms. If you are not good or new to hand coding, this is a simple way to build this type of function. I've used these extensions to create functions quickly and to learn how to hand code. My goal is still to learn to code by hand and not rely on these type of extensions, but in a pinch, they work alright.
  5. I used DW MX 2004 and the MX Widget Ext. to build a dependant drop down function. The drop downs work great in filtering the databases down to the specific product. However, I can't figure out how to link the last drop down to a display/ result page (product specific page). I've tried using url param and java onClick, but the same page loads every time. This is the type of code I've used. onClick="document.location.href='product.php?product_id=<? php echo [$rowRecordset5('product_id')]; ?>'" Three questions: Where am I going wrong with linking the selection in the last drop down with the results page? Is there a better way to build dependant drop down menus when using a lot of files? If so, any good books or tutorials to learn from? Thanks for helping this newbie.
  6. It seems simple enough. Thanks for the help.
  7. In this new table, is a new record inserted or a new field created in the table? If only a record, then do I need a specific number of fields or can I allow an unlimited number of "favorites"?
  8. Yeah, I'm using a mysql database for the site.
  9. I'm pretty new to php/mysql. Is it possible to write a script where the user stores internal links to other parts of the website under a "my favorites" section. I need to allow the user to click on a link (i.e. "add to my favorites") next to a product and have an internal link added to that specific users profile under a "my favorites" tab. I've thought about cookies but the user should be able to access these preferences from any computer. Does anyone have any suggestions? Any scripts out there for this? Please teach this newbie a thing or two. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.