shakti
01-08-2009, 11:05 AM
I have made a form which have two input field.
Now I need to validate those input.
Here is the Form
<form name="form1" action="form2.php" method="post">
<input type="text" value="" name="credit" size="11" maxlength="11"/>
<input type="text" value="" name="credit2" size="11" maxlength="11"/>
<input type="submit" value="submit" />
</form>
Now I need to validate them.
As I am only 16 and completely new in PHP, I am unable to validate them.
Please give me some codes which can validate those field.
I need to set the values of those fields as-
1. Values must be digits(0123456789).
2. Maximum and minimum length is 11.
3. 2 Values must be same.
4. First 3 digit must be 017 or 018 or 019 or 011.
5. If first 3 digit is 017 then $provider = "GrameenPhone";
6. If first 3 digit is 018 then $provider = "Aktel";
7. If first 3 digit is 019 then $provider = "Banglalink";
8. If first 3 digit is 011 then $provider = "Citycell";
Please do them with php.
Make it by -
if ($_POST['credit'] != $_POST['credit2']) {
echo "Valuse are not same";
}
elseif (Please help me to code here to validate values as disired.) {
}
else {
I will handle this section.
}
Please help me by doing this.
Now I need to validate those input.
Here is the Form
<form name="form1" action="form2.php" method="post">
<input type="text" value="" name="credit" size="11" maxlength="11"/>
<input type="text" value="" name="credit2" size="11" maxlength="11"/>
<input type="submit" value="submit" />
</form>
Now I need to validate them.
As I am only 16 and completely new in PHP, I am unable to validate them.
Please give me some codes which can validate those field.
I need to set the values of those fields as-
1. Values must be digits(0123456789).
2. Maximum and minimum length is 11.
3. 2 Values must be same.
4. First 3 digit must be 017 or 018 or 019 or 011.
5. If first 3 digit is 017 then $provider = "GrameenPhone";
6. If first 3 digit is 018 then $provider = "Aktel";
7. If first 3 digit is 019 then $provider = "Banglalink";
8. If first 3 digit is 011 then $provider = "Citycell";
Please do them with php.
Make it by -
if ($_POST['credit'] != $_POST['credit2']) {
echo "Valuse are not same";
}
elseif (Please help me to code here to validate values as disired.) {
}
else {
I will handle this section.
}
Please help me by doing this.