[thelist] ajax dynamic dropdown menu set
Bob Meetin
bobm at dottedi.biz
Wed Aug 4 10:11:15 CDT 2010
Jack Timmons wrote:
> On Wed, Aug 4, 2010 at 3:28 AM, Simon MacDonald <simonmacdonald at uk2.net> wrote:
>
>> In findCounty.php
>> You have:
>> <option value><?=$row['county']?> - ID: <?=$row['id']?>
>> Should have:
>> <option value<?=$row['id']?>><?=$row['county']?> - ID: <?=$row['id']?>
>>
>> Hope that works
>>
>> Simon
>>
>
> JIC, don't forget the ="":
>
> <option value="<?=$row['id']?>">
>
> Although I assume Simon left them out knowing you'd have picked it up,
> can't say the same about future visitors looking through the email.
>
> Also, is this script going to be only running on this server, and is
> the PHP.ini likely to stay the same? You're using shorttags, which
> might be disabled elsewhere or deprecated in future releases.
>
I changed the relevant code in all three find* files to resemble this
findCounty.php
<select name="county" onchange="getCity(<?=$state?>,this.value)">
<option>Select County</option>
<?php while($row=mysql_fetch_array($result))
{ ?>
<option value="<?=$row['id']?>">
<?=$row['county']?> - ID: <?=$row['id']?>
</option>
<?php }
?>
</select>
<?php echo "(State ID: $state)"; ?>
The echo statements are there just for testing. Unfortunately this does
not help. The county variable which should be the row['id'] doesn't
pass to getCity or findCity.php. The script owner replied, "Getcity
function expects 3 parameters but you're sending only two from the
onchange action. send 3 and its fine. " but hasn't replied with further
details how to ensure this happen.
The way the db relationships and tables are set, I don't think
findCity.php actually needs all three variables, but it does need
$county. I rezipped the package with the changes.
http://www.dottedi.biz/code/ajax/4levelselect/
http://www.dottedi.biz/code/ajax/4levelselect/4levelselect.zip
<?=$row['county']?> --> Is this a shorttag you're referring to? If I
change to <?php=$row['county']?> the script errors.
--
Bob Meetin
dotted i
303-926-0167 (home/business)
www.dottedi.biz/blog.php
More information about the thelist
mailing list