Hi i m trying to create two drop down list boxes where the second drop downl list box is populated based on the selection of the first one.I have searching the net for days and even the scripts i downloaded don't seem to be working..Can anyone help me plz.....Its urgent...I have deadline approaching....

Recommended Answers

All 4 Replies

This looks like a javascript problem to me. When is your deadline?

Larry

Hi,

I don't know Javascript all that well. Here is a script I wrote 4 years ago when I was first learning web design. It does what you say you want. Maybe it will give you some ideas.

<HTML>

<head>
<title>Concat two strings</title>

</head>

<form name="demo">

<P>Input1: <input type="text" name="inP1" size=40></p>

<P>Input2: <input type="text" name="inP2" size=40></p>



<p>
<input type="button" name="button2" value="Concatinate Strings" onclick="document.answer.out.value = document.demo.inP1.value + document.demo.inP2.value"> 
</p>
</form>

<form name="answer">

<p>Output: <input type="text" name="out" size=40></p>
</form>
</BODY>
</HTML>

Hi,

I think I have something. I think what you want is a self-posting page.
The follow example kind of does close to what you want.

Get rid of the arrays and use the MySQL commands and I think you will have something you can use.

I hope this helps.

Here is that code:

<html>
<head>
</head>
<body>
<?php
$key = $_GET['$key'];
?>

<p>Input animal type:</p>
<form id="form1" action="<?php echo $_SERVER['PHP-SELF'] ?> " method="get">
<p>Input1: <input type="text" name="key" size=40></p>
<p><input type="submit" value="Submit" size=40></p>
</form>

<?php
$key = $_GET['key'];
if (!is_null($key)) {

$row[0] = "Cow";
$row[1] = "Deer";
$row[2] = "Fox";
$row[3] = "Cat";

//$result = mysql_query("SELECT * FROM animal_record WHERE Key='$key'"); 

$i = 0;

echo "<p>Results:</p>";

echo "<form>";
echo "<select name='category'>";

//while($row = mysql_fetch_row($result))

while($i < 4){
   echo "<option>$row[$i]</option>";
   $i += 1;
} /* End while */
echo "</select>";
echo "</form>";

} /* End if */
?>
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.