SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2007
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to send an array in Javascript to PHP?

    HI all,
    Sorry first of all bcoz i've a question which involves php also.I'm using the below code from php to javascript check function.

    Code:
    echo "<td><center><input name=\"sstreamname\" type=\"checkbox\" onclick=\"check()\"></center></td></tr></font></center></tr></font></center>";

    My point lies here in the below javacript code:

    Code:
    function check()
    {
    
    var frm=document.forms.stream_selection
    
    for(j=1;j<=1000;j++)
    {
      if(!frm[j].checked)
      {
          frm[0].checked=false
      }
    }
    
    }
    From the above code i need to check which checkbox number (that is i've a table containing many values correspondingly their are checkboxes and which one of those checkboxes are ticked). I need to get the number i.e., 1,3,4,5,etc checkboxes are ticked and this needs to be sent to another php page. How do i do it? Please help.

    Thanks,
    Ramki.

  2. #2
    Beer Monster -Ox's Avatar
    Join Date
    Apr 2003
    Location
    sowth afreeka
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ajax / Json
    My postings are a natural product.
    The slight variations in spelling and grammar enhance its
    individual character and beauty and in no way are to be
    considered flaws or defects - http://www.guinnesspig.net

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2007
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok. so i've used as below in the javascript function:

    Code:
    location.href="selected_streams.php?arr="+sel_num

    and accessing in php page as follows:

    Code:
    $stream[]=$_REQUEST['streams'];

    Is it right?

    Thanks,
    Ramki.


Bookmarks

Posting Permissions

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