Results 1 to 3 of 3

Thread: PHP: if checkbox checked...

  1. #1

    PHP: if checkbox checked...

    Hi. I'm making a website that includes a form, and I kind of hit a bump with the php.
    Code:
    PHP:
    {for($i=0; $i<22; $i++)
        {if($_POST["Navs".$i]=='ON')
         {$message.=$i.", ";}}
     
    HTML:
    <tr><td width="425"><input type="checkbox" id="Navs0" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/a_la_carte_p1.jpg" onMouseOver="Nav_but(0, 0)" onMouseOut="Nav_but(1, 0)" onMouseDown="Nav_but(2, 0)" onMouseUp="Nav_but(0, 0)"></td>
    <td width="425"><input type="checkbox" id="Navs1" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/artemis_p1.jpg" onMouseOver="Nav_but(0, 1)" onMouseOut="Nav_but(1, 1)" onMouseDown="Nav_but(2, 1)" onMouseUp="Nav_but(0, 1)"></td></tr>
    <tr><td width="425"><input type="checkbox" id="Navs2" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/aura_p1.jpg" onMouseOver="Nav_but(0, 2)" onMouseOut="Nav_but(1, 2)" onMouseDown="Nav_but(2, 2)" onMouseUp="Nav_but(0, 2)"></td>
    <td width="425"><input type="checkbox" id="Navs3" onClick="Cont_pag5_3()"><img name="But_nav" src="buttons/avail_p1.jpg" onMouseOver="Nav_but(0, 3)" onMouseOut="Nav_but(1, 3)" onMouseDown="Nav_but(2, 3)" onMouseUp="Nav_but(0, 3)"></td></tr>
    ETC to Navs21
    The problem is that the php doesn't "see" if the checkboxes ar checked or not, so that part of $message remains empty...What am I doing wrong? Thank you in advance. Bye.

  2. #2
    You're handling them wrong. When you're trying to grab data from a post it pulls it by the name attribute NOT the id attribute
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  3. #3
    Quote Originally Posted by simplistik View Post
    You're handling them wrong. When you're trying to grab data from a post it pulls it by the name attribute NOT the id attribute
    Yeah...I figured it out myself about 5 minutes ago...
    Thanks...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012