I can get the $_POST value of my dropdown #1, but I need to get the value BEFORE I submit my form so that I can populate my second dropdown box. My first dropdown represents MASTER CATEGORIES and my second drop down will be SUBCATEGORIES. Can someone help me figure out how to 'capture' the value of my first SELECT box? If the answer is to use JSON, can someone help me with the code so that I can create an array from mysql database? I need the select box to show a verbal value, eg. Horse, but have it 'SAVE' as the ID that it represents in my table...I hope this makes sense...so that I can code as follows: echo "<option value='" . $row2['scID']. "'>" . $row2['sCategory'] . "</option>";

Thanks to anyone that can shed some light....

<?php
require_once('../functions.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AAG&mdash;Admin</title>
<link rel="stylesheet" href="/test/arm/css/arm.css" type="text/css">
<link rel="shortcut icon" href="/test/arm/images/favicon.ico" >
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" >
<style> 
.cke_skin_kama {margin-left:105px;margin-top:70px;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
</head> 
<body> 
<div id="container">
	<div id="hotTopic">
	<?php include ("adminLoginMenu.php") ?>
	</div> <!--end hotTopic-->
<div id="banner">
<a href="http://www.lassfc.com/test/arm/index.php" title="The "><img src="/test/arm/images/aagLogo.png" alt="ARM" width="321" height="106px"/></a>
<?php include("adminMenu.php") ?>
</div> <!--end banner-->
<div id="content">
<h3 style="margin-bottom:30px">Admin Post Insight Article Form</h3>
<div class="investArt">
		<form style="margin-bottom:20px" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
		<label>Author</label>
		<select name="author">
			<option value="">Select one...</option>
			<option value="Bob">Bob</option>
			<option value="Kim">Kim</option>
					</select>
		<?php
		connect();
		$sql = "SELECT * FROM masterCat ORDER BY mCategory";
		$result = mysql_query($sql) or die(mysql_error());
		echo "<select name='masterCat' id='masterCat' onchange=\'reload(this.form)\'>";
		echo "<option value=''>Select one...</option>";
		while($row = mysql_fetch_array($result)){
			echo "<option value='" . $row['mcID']. "'>" . $row['mCategory'] . "</option>";
		}
		echo "</select>";// Closing of first list box
		$sql2 = "SELECT * FROM subCat WHERE mcID=".$_POST['masterCat']." ORDER BY sCategory";
		$result2 = mysql_query($sql2) or die(mysql_error());
		echo "<select name='subCat' id='subCat' onchange=\'reload(this.form)\'>";
		echo "<option value=''>Select one...</option>";
		while($row2 = mysql_fetch_array($result2)){
			echo "<option value='" . $row2['scID']. "'>" . $row2['sCategory'] . "</option>";
		}
		echo "</select>";// Closing of second list box

	?>
	<br>
	<label>Date</label><input type="text" name="artDate"/><br>
	<label>Title</label><input type="text" name="title"/><br>
	<label>Subtitle</label><input type="text" name="subtitle"/><br>
	<label>Body</label><textarea name="articleBody"></textarea><br>
	<input type="submit" name="submit" class="submit" value="Submit">
	</form>
</div> <!--end investArt-->
</div> <!--end content-->
<div class="clearBoth"></div>
</div> <!--end container-->
<div class="clearBoth"></div>
</body>
</html>	
<?php
// Include the CKEditor class.
include_once "../ckeditor/ckeditor.php";

// Create a class instance.
$CKEditor = new CKEditor();

// Path to the CKEditor directory.
$CKEditor->basePath = '../ckeditor/';

// Do not print the code directly to the browser, return it instead.
//$CKEditor->returnOutput = true;
// Replace a textarea element with an id (or name)
$CKEditor->replace('articleBody');
$CKEditor->config['width'] = 600;
connect();
if (isset($_POST['submit'])) {
	$author = protect($_POST['author']);
	$title = protect($_POST['title']);
	$subtitle = protect($_POST['subtitle']);
	$body = protect($_POST['articleBody']);
	$date = protect($_POST['artDate']);
	$masterCat = protect($_POST['masterCat']);
	$subCat = protect($_POST['subCat']);
	if ($author&&$title&&$subtitle&&$body){
		$tempDate = date("Y-m-d H:i:s",strtotime($date));
		if ($author == "Bob"){
			$authorShort = "bobA";
		} elseif ($author == "Kim"){
			$authorShort = "kimH";
		}

	$sql = mysql_query("INSERT INTO articles (author,authorShort,articleBody,mcID,scID,title,subtitle,artDate) VALUES ('$author','$authorShort','$body', '$masterCat', '$subCat', '$title','$subtitle','$tempDate')") or die("Your article has not been posted");
	echo "<script>alert('Record added...'); history.back();</script>";
} else {
	echo "Enter all data please";
} //end if
} //end if isset
?>

    I thought that might be your answer. I am actually glad to have to learn it, but as a site I am doing is about to go live, I'm a little pressed for time. Below is some code that I have working for two drop downs. My only issue is that I am not sure how to have the second dropdown end up with the ID for the subcategory of COFFEE, for instance. Do you recommend an external .json file filled with all the subcategory data? Either way, external or not, do you know how to set it up through a feed from my mysql table (probably creating an array) and how to have the second SELECT statement be the VALUE OF THE ID from my table, not the word COFFEE. Finally, should I create the FIRST SELECT statement as I have with PHP, and only use AJAX for the second? Thanks for any help!!

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

    <script>
    	$(function() {
    
    		$("#json-one").change(function() {
    
    			var $dropdown = $(this);
    
    			$.getJSON("json/data.json", function(data) {
    
    				var key = $dropdown.val();
    				var vals = [];
    
    				switch(key) {
    					case 'beverages':
    						vals = data.beverages.split(",");
    						break;
    					case 'snacks':
    						vals = data.snacks.split(",");
    						break;
    					case 'base':
    						vals = ['Please choose from above'];
    				}
    
    				var $jsontwo = $("#json-two");
    				$jsontwo.empty();
    				$.each(vals, function(index, value) {
    					$jsontwo.append("<option>" + value + "</option>");
    				});
    
    			});
    		});
    
    	});
    </script>
      Write a Reply...