Jump to content

um inputes quick question


scheols

Recommended Posts

ok here you go

a simple form with three check boxes with the isset submit
[code=php:0]<?php
if (isset(submit) {
    if (!$test) { //the name of the checkbox
      echo "You did not check a box";
      exit;
    }
//do something
}
?>
<form method="POST" action="whatever.php">
<input type="checkbox" name="test" value="test"> test<br>
<input type="checkbox" name="test" value="test2"> test2<br>
<input type="checkbox" name="test" value="test3"> test3<br>
<p><input type="submit" value="Submit" name="submit"></p>
</form>[/code]

Hope this helps,
Tom
Link to comment
Share on other sites

Actually, you need to give the checkboxes different names, otherwise you will only get the value of the last one, unless you call them "test[]" for example, then you get an array with their values. With radio buttons, you give each radio button in the set the same name but different values, and the variable with the corresponding name will have the value of whichever one is selected.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.