Results 1 to 5 of 5

Thread: problem reciving check box values using post method

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow problem reciving check box values using post method

    Hi all i got a form with many checkboxes and i want to pass checkbox varaibles to a new page using post method but the problem is that each time the first variable get pasted .Beleow u see part of php code that recives the passed variables. When i run this script by selecting 3 check boxes which has values :1 first check box, 2 second checkbox and 3 3th checbox. i get this

    select filename,title from wimpy where id=1

    instead of

    select filename,title from wimpy where id=1 OR id=2 OR id=3

    I be happy if an expert help me fix this problem and be able to pass all values of check box to second page and be able to buil query such :
    select filename,title from wimpy where id=1 OR id=2 OR id=3
    Thanks

    part of check box form code:
    Code:
    <form method="POST" action="./playlist.php"  name="mp3Play">
    ...
    ...
    ...
    playlist.php code
    Code:
    <?php
    
    //echo $_POST['id']; 
    
    $user = "root";
    $pw = "";
    $db = "mp3sversion5";
    $mysql_access = mysql_connect("localhost", $user, $pw);
    mysql_select_db($db, $mysql_access);
    
    
    if (isset($_POST['Id'])) {
        $fragments = explode(',',$_POST['Id']);
        $loopCount = sizeof($fragments);
        for ($loop = 0; $loop < $loopCount; $loop++) {
            if ($where != '') $where .= ' OR';
            $where .= ' id='.$fragments[$loop].' ';
        }}
    $query = "select filename,title from wimpy where $where";
    
    echo $query;
    
    $result = mysql_query($query);
    Last edited by tony007; Feb 20th, 2006 at 02:30 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width