che_anj
01-24-2008, 04:44 PM
Hello, I have problem with regards to select onchange.. heres the link
http://etlite.com/index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=2
You see the dropdown box when I choose any from that dropdown this will display
http://etlite.com/index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=4
if I click any letter below it will display the list of countries that start with the letter that I click.. e.g. letter P all countries that start with letter p will display
but If i click again the dropdown to select another currency.. the list of countries will go back to the first letter which is A.
Id like to be the list remaind in P unless it click another Letter..
heres my code..
<script type="text/javascript">
function reloads(form)
{
var val=form.cur_to.options[form.cur_to.options.selectedIndex].value;
self.location='index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=' + val;
}
</script> // this for the reload form when clicking the dropdown
-------------------------------------------------
<select name="cur_to" onchange="reloads(form);">
<?
while($rows=mysql_fetch_array($results))
{
if($_GET[cur_to]==$rows[id])
echo "<option value='$rows[id]' selected>$rows[countryn]</option>";
else
echo "<option value='$rows[id]'>$rows[countryn]</option>";
}
?>
</select>///this is the select box.
query code..
if(isset($_POST['cur_to']) || isset($_GET['cur_to']))
{
$curid=$_GET[cur_to];
$query="select * from currency where id='$curid'";
$result=mysql_query($query);
}
else if(!isset($_POST['cur_to']))
{
$query="select * from currency where id='1'";
$result=mysql_query($query);
}
$row=mysql_fetch_array($result);
$rates=$row[rate];
---------------array Letter----------------
<tr><td class="rc"></td>
<?
$curid=($curid!='') ? $curid : 1;
$letter=array("A","B","C","D","E","F","G","H","I","J","K","L","N","M","O","P","Q","R","S","T","U","V","W","X","Y","Z",);
$i=0;
?>
<td colspan="2" align="center"><? foreach($letter as $key)
{
echo '<button id="Edit" onClick="self.location.href=\'?option=com_content&task=view&id=13&Itemid=30&cur_to='.$curid.'&country='.$key[$i].'\';" class="alpha" id="'.$key[$i].'" >'.$key[$i].'</button>';
}?></td></tr>
anyone could help me.. thanks..
http://etlite.com/index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=2
You see the dropdown box when I choose any from that dropdown this will display
http://etlite.com/index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=4
if I click any letter below it will display the list of countries that start with the letter that I click.. e.g. letter P all countries that start with letter p will display
but If i click again the dropdown to select another currency.. the list of countries will go back to the first letter which is A.
Id like to be the list remaind in P unless it click another Letter..
heres my code..
<script type="text/javascript">
function reloads(form)
{
var val=form.cur_to.options[form.cur_to.options.selectedIndex].value;
self.location='index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=' + val;
}
</script> // this for the reload form when clicking the dropdown
-------------------------------------------------
<select name="cur_to" onchange="reloads(form);">
<?
while($rows=mysql_fetch_array($results))
{
if($_GET[cur_to]==$rows[id])
echo "<option value='$rows[id]' selected>$rows[countryn]</option>";
else
echo "<option value='$rows[id]'>$rows[countryn]</option>";
}
?>
</select>///this is the select box.
query code..
if(isset($_POST['cur_to']) || isset($_GET['cur_to']))
{
$curid=$_GET[cur_to];
$query="select * from currency where id='$curid'";
$result=mysql_query($query);
}
else if(!isset($_POST['cur_to']))
{
$query="select * from currency where id='1'";
$result=mysql_query($query);
}
$row=mysql_fetch_array($result);
$rates=$row[rate];
---------------array Letter----------------
<tr><td class="rc"></td>
<?
$curid=($curid!='') ? $curid : 1;
$letter=array("A","B","C","D","E","F","G","H","I","J","K","L","N","M","O","P","Q","R","S","T","U","V","W","X","Y","Z",);
$i=0;
?>
<td colspan="2" align="center"><? foreach($letter as $key)
{
echo '<button id="Edit" onClick="self.location.href=\'?option=com_content&task=view&id=13&Itemid=30&cur_to='.$curid.'&country='.$key[$i].'\';" class="alpha" id="'.$key[$i].'" >'.$key[$i].'</button>';
}?></td></tr>
anyone could help me.. thanks..