How to validate text box contents?

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

  1. #1
    in my webiste (php , sql).. i have two text box for entering details and a submit button..
    i need help in the code for validation of the contents in text box..

    ie if i am clicking submit without entering details.. then it should display a message " enter details".. likewise for the other 2 textbox also..

    code used to create the text box is given below..
    <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:
    pls help me....
     
    rrn, Apr 12, 2009 IP