Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Check box group submit (php)


THIS HERE IS THE FORM

<form action="checkbox-form.php" method="post">

Which buildings do you want access to?<br />
<input type="checkbox" name="formDoor[]" value="A" />Acorn Building<br />
<input type="checkbox" name="formDoor[]" value="B" />Brown Hall<br />
<input type="checkbox" name="formDoor[]" value="C" />Carnegie Complex<br />
<input type="checkbox" name="formDoor[]" value="D" />Drake Commons<br />
<input type="checkbox" name="formDoor[]" value="E" />Elliot House

<input type="submit" name="formSubmit" value="Submit" />

</form>



check-form.php

<?php
  $aDoor = $_POST['formDoor'];
  if(empty($aDoor)) 
  {
    echo("You didn't select any buildings.");
  } 
  else 
  {
    $N = count($aDoor);

    echo("You selected $N door(s): ");
    for($i=0; $i < $N; $i++)
    {
      echo($aDoor[$i] . " ");
    }
  }
?>
Comment

PREVIOUS NEXT
Code Example
Php :: SQLSTATE[42S02]: Base table or view not found: 1146 Table many to many in laravel 
Php :: how can get attribute without getter in laravel 
Php :: php blade first child @foreach 
Php :: spatie/laravel-health 
Php :: laravel create event listener 
Php :: php regex markdown link 
Php :: Validate checkboxes laravel 
Php :: how to get the top_area in orders laravel 
Php :: wordpress plugin public page 
Php :: direct without public laravel 
Php :: sorting table row data with php 
Php :: imprimir texto en php 
Php :: visual studio php dollar sign double click 
Php :: php executor 
Php :: Formatting an Excel Column 
Php :: php run python script with arguments json 
Php :: King Composer Theme Export 
Php :: wordpress redirect attachment page to file 
Php :: convert array to associative array php 
Php :: opencart set page title config php 
Php :: addcslashes (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: java script clear rectangle 
Php :: __sleep and __wakeup 
Php :: sort names alphabetically php 
Php :: convert php to curl 
Php :: laravel eloquent pass to next element 
Php :: Command "make:auth" is not defined. 
Php :: laravel illuminate filesystem not found 
Php :: Drupal get node id from view 
Php :: can we generate alphanumeric 6 digit primary key in phpmyadmin 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =