select option and php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all ,

 I have a code below :

 function goToPageSelect($selectname,$totalItems){

  $_logger = new Log4jLogger();
  $_logger->logdebug("starting ..goToPageSelect()");
  $_logger->logdebug("starting ..goToPageSelect()", $totalItems);

$selecthtml = "Go to Page:<select name=\"$selectname\" class=\"inputfield\" onchange=\"javascript:gotoPage()\">";
  for ($index=0;$index<$totalItems;$index++){
    $value = $value + 1;
    $selecthtml .= "<option value=\"$value\">$value</option>";
  }
  $selecthtml .= "</select>";
  return $selecthtml;
}

It will produce the html tag as shown below:
<script language="JavaScript">
function gotoPage(){

 var urlpath = "../listflag.php?start=&pageID="+3;
 document.forms['listfrm'].method = 'post';
 document.forms['listfrm'].action = urlpath;
 document.forms['listfrm'].submit;

}
</script>

<form name="listfrm">
Go to Page:<select name="pageid" class="inputfield" onchange="javascript:gotoPage()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>	
</form>	


I tried using onchange in the select tag,but it did not work. It go to the javascript but the form is not submitted .

Anyideas why?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux