0

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....

2
Contributors
4
Replies
7
Views
7 Years
Discussion Span
Last Post by Larry_b
0

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>
0

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>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.