Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts

    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..

  • #2
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts
    anybody could help. thanksss

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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.

  • #4
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts
    how to pass the value of the button to the js ..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •