How to clear textbox after ' submit'???

Discussion in 'HTML & Website Design' started by rrn, Apr 9, 2009.

  1. #1
    In my website (php,sql).. there is a textbox where we enter the details..
    after clicking the 'submit' button the entered text is sent as mail to my inbox, tats working fine but my problem is that after clicking 'submit' button..the text still remains in the text box ....
    how can i solve tat??? pls help........

    <form action="index.{EXT}" method="POST" enctype="multipart/form-data" onsubmit="return email_validate();">
    	<table border="1" width="100%" bordercolor="#D0D0D0" bgcolor="">
        <tr>
    	<td colspan="2" class="f-bold fs-11 bg-1 fc-FFF" align="center">Email Alerts</td>
    	</tr>
    	<tr>
    	<td class="bg-EEE f-bold" width="200">Name</td>
    	<td class="bg-F7F"><input type="text" id="name" name="name"  value="{rates.NAME}"  class="box-100" /></td>
    	</tr>
    	<tr>
    	<td class="bg-EEE f-bold" width="200">Email</td>
    	<td class="bg-F7F"><input type="text" id="email" name="email"  value="{rates.EMAIL}"  class="box-100" /></td>
    	</tr>
    	<tr>
         <td colspan="2" align="center"><input type="submit" name="submit" value=" Submit " class="button f-bold pb-3" /></td>
        </tr>
    	</table>
    	</form>
    HTML:
    above shown is the 'form' where we enter the details......




    this is the code for sending email......

    if ($_POST['submit']) {
    $email_from =  $_POST['name']." ".$_POST['email'];     // Who the email is from
    $email_subject = 'Email Alerts from Website';
    $email_message =          '
    	               <table cellpadding="3" cellspacing="1" border="0" width="600">
                                                                                           <tr>
    				                   <td>'.$_POST[name].' has sent the details from Email Alerts</td>
    				</tr>
    
    				<tr>
    					<td width="120">Name</td>
    					<td>'.$_POST[name].'</td>
    				</tr>
    
    				<tr>
    					<td width="120">Email</td>
    					<td>'.$_POST[email].'</td>
    				</tr>
                     </table>
    				';
    
    $email_to  = 'renu@gulfnav.com';
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    $headers .= "From: ".$_POST[email];
    @mail($email_to, $email_subject, $email_message,  $headers);
    
    PHP:

    smbdy pls giv me a solution.......
    thank u.........
     
    rrn, Apr 9, 2009 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add a reset button
    <input type="reset" />
     
    Cash Nebula, Apr 9, 2009 IP