Onchange() not submitting values

Discussion in 'PHP' started by modestmj, Aug 4, 2009.

  1. #1
    Hi everyone,
    I have a very weird issue here. I'm posting values using a dropdown box by using Onchange function in javascript. When I select any value in the dropdown only the first time the value is posted, but when I click the same dropdown and select some other value, it only calls the javascript function but does not submit the value. Please help me here..

    My code is

    <select name="classList" onchange="refresh();">
    <option value="">--select--</option >
    <?php
    foreach($Class as $cls)
    {
    ?>
    <option value="<?php echo $cls['class'] ?>"<?php if($cls['class']==@$classList) echo "selected"; ?>>
    <?php echo $cls['class'] ?></option>
    <?php
    }
    ?>
    </select>
    Code (markup):
    And the javascript code is

     function refresh()
     {
      document.formName.action="";
      document.formName.submit();
     }
    Code (markup):
     
    modestmj, Aug 4, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is a javascript problem, not PHP. You should show the entire HTML page or link to an online page we can try.
     
    premiumscripts, Aug 4, 2009 IP