|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
drop down list help needed
Ok i've been having trouble with this for a while so i hope someone here can help. I have a drop down list from which you can select a state and the save it. It then get's inputed in a mysql database. And when i go back to the page the option i selected before remains selected on the drop down list and it all works ok. However now i would need to modify the list so that instead of AZ for Arizona, when i select Arizona i want <a href="http://www.google.com>Google</a> inputed in the database. This is just an example. Now how would i modify the drop down box to accomodate this. Here is the code:
Code:
<?php
// THIS IS YOUR ARRAY
$a[0][0] = "AL";
$a[0][1] = "Alabama";
$a[1][0] = "AK";
$a[1][1] = "Alaska";
$a[2][0] = "AZ";
$a[2][1] = "Arizona";
$a[3][0] = "AS";
$a[3][1] = "Arkansas";
$a[4][0] = "CA";
$a[4][1] = "California";
echo "<select name="medal_image">";//uncomment this line when you want it to work
foreach ($a as $v1)
{
echo "<pre>a = ",var_dump($a),"</pre><br>n";
echo "<pre>v1 = ",var_dump($v1),"</pre><br>n";
//next two lines were used for testing when the second loop was uncommented
echo "v1 = ",var_dump($v1),"<br>n";
echo "v2 = ",var_dump($v2),"<br>n";
echo "<pre>$medal_image = ",var_dump($medal_image),"</pre><br>n";
if ($v1[0] == $medal_image) //$state holds a two-letter acronym (i.e: "AL")
//maybe after you add some more code that will be true
//right now, $state is always NULL
{
$sel_text = " selected ";
}
else
{
$sel_text = " ";
}
echo "<option value=$v1[0]".$sel_text.">".$v1[1]."</option>";
}
echo "</select>";//uncomment this line when you want it to work
?>
|
|
#2
|
|||||
|
|||||
|
RE: drop down list help needed
php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > drop down list help needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|