Jump to content

CHecking Fields Before Submitting


ballouta

Recommended Posts

Hello

I have this form:

 

<FORM name=frm method="POST" action="register.php">
<p dir="ltr" style="margin-bottom: 15px">
<font face="Verdana" color="#FF0000" style="font-size: 9pt; font-style: italic">
required fields</font></p>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
	<tr>
		<td width="87"><font face="Verdana" size="2">Full Name</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="fname" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">Email</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="email" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">Mobile #</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="mobile" size="20" style="color: #000000"></td>
	</tr>
<tr>
		<td width="87"><font face="Verdana" size="2">Country</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="country" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">password</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="password" name="pass" size="20" style="color: #000000"></td>
	</tr>

 

and this javascript in a separate file, it working properly.

 

function isReady() {

// check if the First Name is valid
    if (isProper(frm.fname.value) == false) {
        alert("Please enter your First Name");
        return false;
    }

// check if the email address is valid
    if (isEmail(frm.email.value) == false) {
        alert("Please enter a valid email address");
        return false;
    }
    return true;
}

 

I need to add to code:

1) mobile verification, only numbers are allowed, no matter how long

2) make sure that the password is between 8 and 12 characters.

 

Thanks alot

Link to comment
https://forums.phpfreaks.com/topic/110691-checking-fields-before-submitting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.