mokimofiki
Aug 25th 2008, 11:26 am
I know absolutly 0 javascript but would like to autopopulate an option box based on a previous options choice. This is what I have so far could any of you fine javascript ubers please help me out?
in the header:
<html>
<head>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.series.options[form.series.options.selectedIndex].value;
self.location='newquote.php?series=' + val ;
}
</script>
</head>
in the body:
<form method="post" action="bridgestartnewquote.php">
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="right">Series:
<?php
$result = mysql_query("SELECT series FROM series");
print "<select name=series onchange=\"reload(this.form)\"> \n";
print "<option></option>";
while($row = mysql_fetch_assoc($result))
{
print "<option value=\"{$row['series']}\">{$row['series']}</option> \n";
}
print "</select> \n";
?>
</td>
<td width="275" align="right">Name: <input type="text" name="quotename" style="width: 150px"></td>
<td width="275" align="right">Model:
<?php
$result = mysql_query("SELECT model FROM models");
print "<select name=model> \n";
print "<option></option>";
while($row = mysql_fetch_assoc($result))
{
print "<option value=\"{$row['model']}\">{$row['model']}</option> \n";
}
print "</select> \n";
?>
</td>
</tr>
<td></td>
<td></td>
<td align="right"><input type="submit" value="Start Quote"></td>
</table>
</form>
This is obviously a combination of php and javascript .... thank you for any help :)
in the header:
<html>
<head>
<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.series.options[form.series.options.selectedIndex].value;
self.location='newquote.php?series=' + val ;
}
</script>
</head>
in the body:
<form method="post" action="bridgestartnewquote.php">
<table width="750" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="right">Series:
<?php
$result = mysql_query("SELECT series FROM series");
print "<select name=series onchange=\"reload(this.form)\"> \n";
print "<option></option>";
while($row = mysql_fetch_assoc($result))
{
print "<option value=\"{$row['series']}\">{$row['series']}</option> \n";
}
print "</select> \n";
?>
</td>
<td width="275" align="right">Name: <input type="text" name="quotename" style="width: 150px"></td>
<td width="275" align="right">Model:
<?php
$result = mysql_query("SELECT model FROM models");
print "<select name=model> \n";
print "<option></option>";
while($row = mysql_fetch_assoc($result))
{
print "<option value=\"{$row['model']}\">{$row['model']}</option> \n";
}
print "</select> \n";
?>
</td>
</tr>
<td></td>
<td></td>
<td align="right"><input type="submit" value="Start Quote"></td>
</table>
</form>
This is obviously a combination of php and javascript .... thank you for any help :)