mixing php, javascript and html: please help

Thread Solved

Join Date: Feb 2009
Posts: 10
Reputation: swit is an unknown quantity at this point 
Solved Threads: 0
swit swit is offline Offline
Newbie Poster

mixing php, javascript and html: please help

 
0
  #1
Feb 17th, 2009
Hello every one, i am new here so i would appreciate any help wit this.
i am trying to call a url using javascript in an html select statement as follows;

echo "<select>";
for ($i = 0; $i < $pages; $i++) {
?>
<option value=''
onClick='javascript:window.location.href= "index.php?option=<?php echo $option; ?>&task=view&limit=<?php echo $lmt * $i; ?>&id=<?php echo $idpik; ?>&Itemid=<?php echo $Itemid; ?>"'><?php echo $i; ?></option>
<?php
}

echo "</select>";
however, this works in other browsers except IE6. please help me out. thank you. i luv this forum already
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: mixing php, javascript and html: please help

 
1
  #2
Feb 17th, 2009
here is how i would do it

  1. echo '<select onchange="javascript:window.location.href=this.value">';
  2. for ( $i=0,$i<$pages,$i++ ) {
  3. echo "<option value=\"index.php?option={$option}&task=view&limit=". $lmt * $i . "&id={$idpik}&Itemid={$Itemid}\">{$i}</option>";
  4. }
  5. echo '</select>';
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 10
Reputation: swit is an unknown quantity at this point 
Solved Threads: 0
swit swit is offline Offline
Newbie Poster

Re: mixing php, javascript and html: please help

 
0
  #3
Feb 17th, 2009
Thanx alot, @kkeith29 this works perfect in both FF and IE6.
i luv this site.
i have another problem though. this code below works in FF but not in IE.
  1. <option value='district' onClick='javascript:javaFunctiondistrict();'>district</option>

any help will be appreciated. thanx again @kkeith29, you have made my day.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: mixing php, javascript and html: please help

 
0
  #4
Feb 17th, 2009
is this in the same form?

also, is that the only value that needs to call that function for is there a function for each option.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 10
Reputation: swit is an unknown quantity at this point 
Solved Threads: 0
swit swit is offline Offline
Newbie Poster

Re: mixing php, javascript and html: please help

 
0
  #5
Feb 17th, 2009
yes there is a function for each option.
no its not in the same form. here is the whole select statement
  1. <select name='field_general' size='1' class='inputbox' id='field_city'>
  2. <option value='allgene'>...select...</option>
  3.  
  4. <option value='district' onClick='javascript:javaFunctiondistrict();'>district</option>
  5.  
  6. <option value='gender' onClick='javascript:javaFunctiongender();'>Gender</option>
  7. <option value='status' onClick='javascript:javaFunctionstatus();'>status</option>
  8. <option value='type' onClick='javascript:javaFunctiontype();'>type</option>
  9. </select>
and here is one of the functions;
  1. function javaFunctionschool(){
  2.  
  3. var url="index.php?option=com_artband&Itemid=73?action=phpFunctionSchool";
  4. window.open(url, "_self");
  5.  
  6. }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 697 | Replies: 4
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC