Home php Default value in the HTML-form field

Default value in the HTML-form field

Author

Date

Category

How to make the default field in the default field and user can erase it and write your own?

while I have the following workpiece:

& lt; form name = "name" method = "post" action = "sotr.php" & gt;
 & lt; td align = "center" & gt; & lt; Input Type = "text" size = '5' name = "user" & gt; & lt; / td & gt;
 & lt; td align = "center" & gt; & lt; input type = "submit" value = "Add" & gt; & lt; / td & gt;
& lt; / form & gt;

Answer 1, Authority 100%

& lt; form name = "name" method = "post" action = "sotr.php" & gt;
 & lt; td align = "center" & gt; & lt; input type = "text" name = "user" value = "Enter the value" Onblur = "if (value ==") value = 'Enter the value' "onfocus =" if (Value == 'enter the value') value = '' & gt; & lt; / td & gt;
 & lt; td align = "center" & gt; & lt; input type = "submit" value = "Add" & gt; & lt; / td & gt;
& lt; / form & gt;

Answer 2, Authority 100%

& lt; form name = "name" method = "post" action = "sotr.php" & gt;
  & lt; td align = "center" & gt;
    & lt; Input Type = "text" size = '5' name = "user" value = "VAL" & gt;
  & lt; / td & gt;
  & lt; td align = "center" & gt;
    & lt; Input Type = "submit" value = "Add" & gt;
  & lt; / td & gt;
 & lt; / form & gt;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions