Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-24-2008, 04:44 PM   PM User | #1
che_anj
Regular Coder

 
che_anj's Avatar
 
Join Date: Aug 2006
Location: Philippines
Posts: 157
Thanks: 12
Thanked 3 Times in 3 Posts
che_anj is an unknown quantity at this point
select onchange..

Hello, I have problem with regards to select onchange.. heres the link

http://etlite.com/index.php?option=c...id=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=c...id=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..
PHP 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..
che_anj is offline   Reply With Quote
Old 01-24-2008, 05:17 PM   PM User | #2
che_anj
Regular Coder

 
che_anj's Avatar
 
Join Date: Aug 2006
Location: Philippines
Posts: 157
Thanks: 12
Thanked 3 Times in 3 Posts
che_anj is an unknown quantity at this point
anybody could help. thanksss
che_anj is offline   Reply With Quote
Old 01-24-2008, 07:09 PM   PM User | #3
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
You'll have to check if country has a value and pass that in your javascript since that's what you're doing the redirect with. You are not passing it into the query string if you look at your JS redirect.
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 01-28-2008, 10:19 AM   PM User | #4
che_anj
Regular Coder

 
che_anj's Avatar
 
Join Date: Aug 2006
Location: Philippines
Posts: 157
Thanks: 12
Thanked 3 Times in 3 Posts
che_anj is an unknown quantity at this point
how to pass the value of the button to the js ..
che_anj is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:31 AM.


Advertisement
Log in to turn off these ads.