Mega Code Archive

 
Categories / Php / File Directory
 

Form Examples Text Boxes to Drop Downs

<html> <head> <title>Form Examples</title> </head> <body> <form name="form" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"> Form Examples<br> Enter some text or numbers: <input name="TextData" type="text" value=""><br> Select one or more checkboxes: <input name="one" type="checkbox" value="Box one, ">One <input name="two" type="checkbox" value="Box two, ">two <input name="three" type="checkbox" value="Box three, ">three<br> Select <b>one</b> of the radio buttons: <input name="radio" type="radio" value="Mum" >Mum <input name="radio" type="radio" value="Dad" > Dad <input name="radio" type="radio" value="Kitty Cat" > Kitty Cat <BR> Replace the text in this box with your own text: <textarea name="boxy" rows=5 cols=20 wrap="off">Example Data </textarea><br> Now select <b>one</b> of the drop down choices: <select size="1" name="Name"> <option value=""> </option> <option value="value1">Item1</option> <option value="value2">Item2</option> <option value="value3">Item3</option> <option value="value4">Item4</option> </select> <br> Now select<b> some </b> of the drop down choices: <select name="data[]" size="10" multiple > <option value="London">London</option> <option value="Manchester">Manchester</option> <option value="Glasgow">Glasgow</option> <option value="Winchester">Winchester</option> <option value="Oxford">Oxford</option> </select> <input type="submit" name="submit1" value="OK" > </form> <hr> <?php $TextData=$_POST["TextData"]; echo $TextData.'<br>'; $box=$_POST["one"]; echo $box.' '; $box=$_POST["two"]; echo $box.' '; $box=$_POST["three"]; echo $box.' '; $radio=$_POST["radio"]; echo '<b>'.$radio.'</b> '; $boxy=$_POST["boxy"]; echo $boxy.' '; $Name=$_POST["Name"]; echo $Name.'<br>'; $data = $_POST["data"]; foreach ($data as $value) { echo $value."<br>"; } ?> </body> </html>