Results 1 to 6 of 6

Thread: How to pass value of checkbox form to another form?

  1. #1

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

    Arrow How to pass value of checkbox form to another form?

    Hi all i created a dynamic check box form. I let the user to select a few songs and once they click on submit all those values get passed to a second checkbox form. My first checkbox form data ouf of this query:

    $query = "SELECT id,artist,track,album,title FROM files where album='$albumname' order by track";

    The code beleow is part of my checkbox form.The values on bold are those that i need to display them in second page check box form. My problem is that i do not know how to pass those select checked box values to next page by using post method. I be happy if an expert show me how i can do it.Thanks
    Note : the second form needs to be dynamic too since number of passed values are not the same each time!


    Code:
    <form method="POST" action="./Members/AddToPlayList.php"  name="mp3Play"> 						 <tr>
    
    ?>
       while($row = mysql_fetch_assoc($result))
    {
        						
     <td bgcolor="#C0C0C0"><p align="center"><b><?=intval( $row['track'] );?></b></p>
                            </td>
                            <td bgcolor="#C0C0C0"><input
                            type="checkbox" name="Id" value='<?=intval( $row['id'] );?>' /></td>
    
                            <td bgcolor="#C0C0C0"><a
                            href="javascript:newWindow('./mp3s/myWimpy.php?queryWhere=Id&queryValue=<?=strval( $row['id'] );?>')"><img
                            src="images/Speaker.gif"
                            alt="Listen to this Song" border="0"
                            width="16" height="16"
                            longdesc="Listen to this Song"></a>&nbsp;<?=strval( $row['title'] );?>
                            </td>
                            <td bgcolor="#C0C0C0"> <?=strval( $row['album'] );?>  </td>
                            <td bgcolor="#C0C0C0"><a
                            href="javascript:newWindow('RateSong.asp?SongID=1')"><img
                            src="images/RatIt.gif"
                            alt="Rate This Song" border="0"
                            width="100" height="22"
                            longdesc="Rate This Song"></a></td>
                            <td align="center" bgcolor="#C0C0C0">0&nbsp;</td>
                            <td bgcolor="#C0C0C0">coming Soon <!-- <a href="../site.php?songID=1&Song=Atash">Read </a>| <a href="./Members/WriteLyrics.php?SongId=1&Song=Atash">Write</a> --> </td>
    <?
    
    
    } //end of while

  2. #2
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432

    Re: How to pass value of checkbox form to another form?


  3. #3

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

    Re: How to pass value of checkbox form to another form?

    Quote Originally Posted by 308holes
    Not what was looking for !!! i need to pass checkbox data to next page using post method!

  4. #4
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: How to pass value of checkbox form to another form?

    change
    PHP Code:
    <input type="checkbox" name="Id" value='<?=intval$row['id'] );?>' />
    to

    PHP Code:
    <input type="checkbox" name="Id[]" value='<?=intval$row['id'] );?>' />
    And to check it
    PHP Code:
    <?
    $ids = $_GET['Id'];
    print_r($ids);
    ?>

  5. #5

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

    Arrow Re: How to pass value of checkbox form to another form?

    Quote Originally Posted by john tindell
    change
    PHP Code:
    <input type="checkbox" name="Id" value='<?=intval$row['id'] );?>' />
    to

    PHP Code:
    <input type="checkbox" name="Id[]" value='<?=intval$row['id'] );?>' />
    And to check it
    PHP Code:
    <?
    $ids = $_GET['Id'];
    print_r($ids);
    ?>
    Thank u for u reply.well the thing is i have more then one check box. Does it print them all ? furthermore how to write the pased id values to mysql? I be happy if u shoe me how to do that.

  6. #6
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: How to pass value of checkbox form to another form?

    tony007, your asking alot of questions about PHP and MYSQL that can be answered in any number of the books out there. I would recommend you go to a local book store and buy one. That way you wont have to post so many questions here. All the books out there provide code and can go into a much more in depth explanation of whats going on and how the code works than anyone here can really type up. Can you also start posting the code you have written? I have noticed that you only post the HTML front end stuff but not the PHP. Sorry to sound rude but everyone here is here to help, not write the code fron scratch for you. I do like how you refer to anyone as an expert
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

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