in reply to Re: html checkbox and perl cgi
in thread html checkbox and perl cgi

Thank you so much!

Replies are listed 'Best First'.
Re^3: html checkbox and perl cgi
by AdrianJ217 (Novice) on Jan 18, 2014 at 19:45 UTC
    Sorry, could you tell me why the value 'on' is an issue? I thought it is considered on only when it's clicked on. I guess I don't understand the difference between name and value. I thought name is what is passed as the parameter to CGI, not value.
      Parameters have two parts, a name and a value. To get the value of a parameter you query its name: $query->param('name') will return the value. With a checkbox, the parameter will only have a value if it is checked, if it is not checked the value will be empty. The value 'on' is not really an issue, but you want your variable $TB to have the value 'TB' not 'on'.
      Thank you. One of my other html forms needed a dropdown menu which didn't need a value. Why is it only checkboxes need a value and not a dropdown menu? Also, I changed the values but still doesn't work. I will try the print statement, but do I have it print back as an html? I'm sorry to bother you so much. I'm kinda new at this.
        It's no bother. Most form inputs do need a value attribute, not just checkboxes. Select menus do have a value but it is contained within the <option> tags. Can you explain what you mean by "still doesn't work". If you comment out your db connection and exit(0); right after your print statements you will get the result in your browser.