HTML input onfocus & onblur?
You want this
<input ...
onfocus="if (this.value==this.defaultValue) this.value = ''"
onblur="if (this.value=='') this.value = this.defaultValue" />
Update: Some newer browsers will do what you want simply by adding the placeholder attribute:
<input placeholder="Please enter your name" />
Here is the PHP according to your code
echo <<<END
<label for="$name">$lable</label>
<input type="$type" name="$name" id="$name" value="$value"
onfocus="if (this.value==this.defaultValue) this.value = ''"
onblur="if (this.value=='') this.value = this.defaultValue"/>
END;
Looking at the source for this page shows the following
<form id="search" action="/search" method="get">
<div>
<input name="q" class="textbox" tabindex="1"
onfocus="if (this.value=='search') this.value = ''"
type="text" maxlength="80" size="28" value="search">
</div>