Тег <textarea></textarea>




Этот тег определяет многострочное поле ввода.



Аргумент Значение
autofocus autofocus
cols number
disabled disabled
form form_id
maxlength number
name text
placeholder text
readonly readonly
required required
rows number
wrap hard
soft




index.php
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>Name Page</title>
  • </head>
  • <body>
  •  <?php
  •  if($_SERVER['REQUEST_METHOD'] == 'POST') {
  •   $a = (string)trim(htmlspecialchars($_POST['a'], ENT_QUOTES));
  •   if($_REQUEST['clear']) {
  •    $a = null;
  •   }
  •  }
  •  ?>
  •  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  •   <fieldset>
  •    <legend>This data will send into a server</legend>
  •    <br />
  •    <textarea name="a" cols="50" rows="10" wrap="hard" autofocus="autofocus"><?php echo $a; ?></textarea>
  •    <br />
  •    <br />
  •    <input type="submit" name="perform" value="Perform" />
  •    &nbsp;&nbsp;
  •    <input type="submit" name="clear" value="&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;" />
  •    <br />
  •   </fieldset>
  •   <fieldset>
  •    <legend>Reading data from a server</legend>
  •    <?php
  •    if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['perform'] && !$_REQUEST['clear']) {
  •     echo '<pre>', $a, '</pre>';
  •    }
  •    else {
  •     echo null;
  •    }
  •    ?>
  •   </fieldset>
  •  </form>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>Name Page</title>
  • </head>
  • <body>
  •  <?php
  •  if($_SERVER['REQUEST_METHOD'] == 'POST') {
  •   $a = (string)trim(htmlspecialchars($_POST['a'], ENT_QUOTES));
  •   if($_REQUEST['clear']) {
  •    $a = null;
  •   }
  •  }
  •  ?>
  •  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  •   <fieldset>
  •    <legend>This data will send into a server</legend>
  •    <br />
  •    <textarea name="a" cols="50" rows="10" wrap="hard" autofocus="autofocus"><?php echo $a; ?></textarea>
  •    <br />
  •    <br />
  •    <input type="submit" name="perform" value="Perform" />
  •    &nbsp;&nbsp;
  •    <input type="submit" name="clear" value="&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;&nbsp;" />
  •    <br />
  •   </fieldset>
  •   <fieldset>
  •    <legend>Reading data from a server</legend>
  •    <?php
  •    if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['perform'] && !$_REQUEST['clear']) {
  •     echo '<pre>', $a, '</pre>';
  •    }
  •    else {
  •     echo null;
  •    }
  •    ?>
  •   </fieldset>
  •  </form>
  • </body>
  • </html>