Тег <input />




Этот тег определяет для ввода данных.



Аргумент Значение
accept audio/*
video/*
image/*
MIME-type
alt text
autocomplete on
off
autofocus autofocus
checked checked
disabled disabled
form form_id
formaction URL
formenctype application/x-www-form-urlencoded
multipart/form-data
text/plain
formmethod get
post
formnovalidate formnovalidate
formtarget _blank
_self
_parent
_top
height pixel
list datalist_id
max number
maxlength number
min number
multiple multiple
name text
pattern text
placeholder text
readonly readonly
required required
size number
src URL
step number
value text
width pixel
type button
checkbox
color
date
datetime
datetime-local
email
file
hidden
image
month
number
password
radio
range
reset
search
submit
tel
text
time
url
week




index.php
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  • </head>
  • <body>
  • <?php
  • if($_SERVER['REQUEST_METHOD'] == 'POST') {
  •  $a = (float)$_POST['a'];
  •  if(isset($_POST['num'])) {
  •   $num = $_POST['num'];
  •  }
  •  if($_REQUEST['clear']) {
  •   $a = null;
  •   unset($num);
  •  }
  • }
  • ?>
  • <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
  •  <fieldset>
  •   <legend>This data will send into a server</legend>
  •   <input type="text" name="a" value="<?php echo $a; ?>" />
  •   &nbsp;&nbsp;&nbsp;
  •   <label>Enter a number</label>
  •   <br />
  •   <br />
  •   <label>Choice a number</label>
  •   <br />
  •   <br />
  •   <input type="checkbox" name="num[]" value="1" />
  •   &nbsp;
  •   <label>1</label>
  •   <br />
  •   <input type="checkbox" name="num[]" value="2" />
  •   &nbsp;
  •   <label>2</label>
  •   <br />
  •   <input type="checkbox" name="num[]" value="3" />
  •   &nbsp;
  •   <label>3</label>
  •   <br />
  •   <br />
  •   <input type="submit" name="perform" value="Perform" />
  •   &nbsp;&nbsp;&nbsp;
  •   <input type="submit" name="clear" value="&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;" />
  •  </fieldset>
  •  <br />
  •  <fieldset>
  •   <legend>Reading data from a server</legend>
  •   <?php
  •   if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['perform'] && !$_REQUEST['clear']) {
  •    echo $a, ' ';
  •    $res = 0;
  •    foreach($num as $key => $value) {
  •     $res += (int)$value;
  •     echo ' + ', $value;
  •    }
  •    echo ' = ', '<b>', $a + $res, '</b>';
  •   }
  •   else {
  •    echo null;
  •   }
  •   ?>
  •   <br />
  •  </fieldset>
  • </form>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  • </head>
  • <body>
  • <?php
  • if($_SERVER['REQUEST_METHOD'] == 'POST') {
  •  $a = (float)$_POST['a'];
  •  if(isset($_POST['num'])) {
  •   $num = $_POST['num'];
  •  }
  •  if($_REQUEST['clear']) {
  •   $a = null;
  •   unset($num);
  •  }
  • }
  • ?>
  • <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
  •  <fieldset>
  •   <legend>This data will send into a server</legend>
  •   <input type="text" name="a" value="<?php echo $a; ?>" />
  •   &nbsp;&nbsp;&nbsp;
  •   <label>Enter a number</label>
  •   <br />
  •   <br />
  •   <label>Choice a number</label>
  •   <br />
  •   <br />
  •   <input type="checkbox" name="num[]" value="1" />
  •   &nbsp;
  •   <label>1</label>
  •   <br />
  •   <input type="checkbox" name="num[]" value="2" />
  •   &nbsp;
  •   <label>2</label>
  •   <br />
  •   <input type="checkbox" name="num[]" value="3" />
  •   &nbsp;
  •   <label>3</label>
  •   <br />
  •   <br />
  •   <input type="submit" name="perform" value="Perform" />
  •   &nbsp;&nbsp;&nbsp;
  •   <input type="submit" name="clear" value="&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;" />
  •  </fieldset>
  •  <br />
  •  <fieldset>
  •   <legend>Reading data from a server</legend>
  •   <?php
  •   if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['perform'] && !$_REQUEST['clear']) {
  •    echo $a, ' ';
  •    $res = 0;
  •    foreach($num as $key => $value) {
  •     $res += (int)$value;
  •     echo ' + ', $value;
  •    }
  •    echo ' = ', '<b>', $a + $res, '</b>';
  •   }
  •   else {
  •    echo null;
  •   }
  •   ?>
  •   <br />
  •  </fieldset>
  • </form>
  • </body>
  • </html>