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
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.