How to clear all textbox text in php

Hi
I am new to php.I want to clear all textbox text on page when user click on
cancel button?How can i do this?Please guide me?

 Thanks.
  Rahul.

You can do this with a simple html :


<form>
// text fields or whatever
<input type = "reset" value="Cancel">
</form>

HI
I have done it but nothing is happening on the page?

   Thanks.
    Rahul.

If the information in the textarea’s is typed in by the user (as opposed to pulled from the database) dujmovicv’s snippet should work.

Otherwise use a javascript to clear them

Yes all the information is pulled from database and showing into textbox.
i made a javascript and called in on button click.but it is also not
working.I am unable to make call to javascript.my javascript is as follow.
function reset(){
alert(“javascript called”);
document.getElementById(“fname”).value=“”;
document.getElementById(“mname”).value=“”;
document.getElementById(“lname”).value=“”;
document.getElementById(“email”).value=“”;
)
on button click
<input type = “submit” value=“Cancel” onclick=“return reset();”>

but the javascript function notgetting called.
Please help me.

<input type = “submit” value=“Cancel” onclick=“reset();”>

You have to define a method for the form such as


<form method="post" action="yourfile.php">
<table border = "0" cellpadding="0" cellspacing="0" width=100%>
<tr bgcolor = "#ffffff">
	<td colspan="4" width="20%">comp</td>
	<td width="30%" align="right"><input type="text" name="company" size="30"></td>
	<td align="right">date</td>
	<td width="20%" align="right"><input type="text" name="date" size="30" value="date" readonly=""></td>
</tr>
<tr bgcolor = "#ffffff">
	<td colspan="4">contact</td>
	<td align="right"><input type="text" name="contact" size="30"></td>
	<td align="right">Fax&nbsp;</td>
	<td align="right"><input type="text" name="fax" size="30"></td>
</tr>
<tr bgcolor = "#ffffff">
	<td colspan="4">address</td>
	<td align="right"><input type="text" name="address" size="30"></td>
	<td align="right">phone</td>
	<td align="right"><input type="text" name="phone" size="30"></td>
</tr>
</table>
<input type="reset" />
<input type="submit" />
</form>


Hi i am calling all the value from database and then displayed into textbox.
i think because of this reset button is not working.I tried it on other form
its workking well.

         Thanks.
          Rahul.

The standard html reset button doesn’t clear your text field, but resets it to its initial value, which in your case is the value you got from your DB.
The way to go is the javascript solution, like spikez said.

Thanx
I have done it…

Just for the benefit of anyone else in the same situation Rahul, what did you do?