Sunday, July 8, 2012

HTML 5 TEXTAREA TUTORIAL WITH WORKING EXAMPLE

If you want to use unlimited number of characters in your form then <textarea> is going to easy your life. According to w3school The <textarea> tag defines a multi-line text input control and hold unlimited number of characters.



A simple example :

<textarea  rows="14" cols="30" ></textarea> 

How to use in language like PHP?
Its simple just check out the example below...

<?php
$msg=(isset($_POST['msg']))?trim($_POST['msg']):'';

if(isset($_POST['submit'])){
    echo $msg;
    }
?>
<form action="" method="post">
Message<br/>
<textarea name="msg" rows="14" cols="30" ></textarea>
<br/>
<input type="submit" name="submit" value="Go"  />


Whats new in HTML 5
autofocus - Specifies that a text area should automatically get focus when the page loads.
placeholder-Specifies a short hint that describes the expected value of a text area.
required-Specifies that a text area is required/must be filled out.

If you have any suggestion or something to add please comment  so I can implement in my blog.

PickMe
Delicious Save this on Delicious

1 comment :

  1. Really its very useful information that you have shared and looks great post.Thanks for sharing the information with us Web Developers in Bangalore | Website Developers in Bangalore

    ReplyDelete

If you have any Question , Suggestion or idea then please comment regarding the post.