Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 30th, 2007, 09:34 PM
Registered User
Join Date: Dec 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dependent Dropdown php/mysql/java


Im kinda new to php/mysql programming and I was hoping I could get some help with this. I am trying to create 2 dependent dropdown menus. gThe first one dictate the content of the second one. I hot the connection right but once the second menu loads I could scroll down the list but nothing it is showing on it. ike i cant see the fonts. I read the page source and it is showing the options on it.
Any help I would greatly appreciate.

Here it is the code:
$category = $item = null; //declare vars

$conn = mysql_connect($server,$user,"");
$db = mysql_select_db('sin',$conn);

if(isset($_GET["category"]) && is_numeric($_GET["category"]))
    $category = $_GET["category"];

if(isset($_GET["item"]) && is_numeric($_GET["item"]))
    $item = $_GET["item"];

<script language="JavaScript">

function autoSubmit()
    var formObject = document.forms['theForm'];


<form name="theForm" method="get">


    <table width="200" border="1">
        <td>Select Category</td>
        <td><select name="category" onchange="autoSubmit();">
          <option value="null"></option>
          <option value="199" <?php if($category == 199) echo " selected"; ?>>Hydraulics</option>
          <option value="299" <?php if($category == 299) echo " selected"; ?>>Electronics</option>
        <td>Select Item</td>
          <div align="center" class="style2 style3">
            <select name="item" onchange="autoSubmit();">
              <option value="1">select Here</option>


        $sql = "SELECT cat, desc_p FROM parts WHERE cat <= $category";
        $items = mysql_query($sql,$conn);

        while($row = mysql_fetch_array($items))
            echo ("<option value=\"$row[desc_p]\" " . ($item == $row["desc_p"] ? " selected" : "") . ">$row[dec_p]</option>");


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dependent DropDown In DataGrid software_developer_kk ASP.NET 1.0 and 1.1 Professional 3 January 29th, 2007 03:13 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Store Items from dropdown menu in mysql database scoobie PHP Databases 0 April 28th, 2005 08:17 AM
Displaying values in dropdown list from mysql db scoobie Beginning PHP 3 January 25th, 2005 12:09 PM
dependent dropdown lists vivshah VS.NET 2002/2003 1 March 29th, 2004 05:25 PM

All times are GMT -4. The time now is 09:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.