0
this is my index.page
<html>
<head><title>Registration</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src='http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js'></script>
<script type="text/javascript">
function validate()
{
if(document.register.name.value == "")
{
alert('Enter valid name');
document.register.name.focus();
return false;
}
if(document.register.email.value == "")
{
alert('Enter valid email');
document.register.email.focus();
return false;
}
else
if(document.register.password == "")
{
alert('Enter Password');
document.register.password.focus();
return false;
}
if(document.register.repeatpassword.value == "")
{
alert('Enter valid repeatpassword');
document.register.repeatpassword.focus();
return false;
}
if(document.register.day.value == "")
{
alert('Enter valid day');
document.register.day.focus();
return false;
}
if(document.register.month.value == "")
{
alert('Enter valid month');
document.register.month.focus();
return false;
}
if(document.register.year.value == "")
{
alert('Enter valid year');
document.register.year.focus();
return false;
}
if(document.register.phone.value == "")
{
alert('Enter valid phone');
document.register.phone.focus();
return false;
}
}
</script>
                    <script type="text/javascript">
                    window.onload = function () {
                    document.getElementById("name").focus();
                    };
                    </script>

<script type="text/javascript">
$(document).ready(function () {
$("#name").blur(function () {
var name = $(this).val();
if (name == '') {
alert('Enter your name');
return false;
document.getElementById('name').focus();
}
else{
$("#availability").html('<img src="loader.gif">&nbsp;Checking availability.');
$.ajax({
  url: "validation.php?uname="+name
}).done(function( data ) {
  $("#availability").html(data);
});   
} 
});
});
</script>

                            <script type="text/javascript">
                            $(document).ready(function () {
                            $("#email").blur(function () {
                            var email = $(this).val();
                            if (email == '') {
                            alert('Enter Email');
                            $("#availability").html("");
                            }
                            else{
                            $.ajax({
                            url: "emailvalid.php?uemail="+email
                            }).done(function( data ) {
                            $("#availability").html(data);
                            });   
                            } 
                            });
                            });
                            </script>
<script language="javascript">
function checkEmail() 
{
var email = document.getElementById('email');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{3})+$/;
if (!filter.test(email.value))
 {
alert('Please provide a valid email address');
document.register.email.focus;
return false;
}
}
</script>

                <script>
                function checkPassword()
                {
                var pwd  = document.getElementById("password").value;
               // pwd = pwd.replace(/^\s+/g, "");  // strip leading spaces
                var rpwd = document.getElementById("repeatpassword").value;
                //rpwd = rpwd.replace(/^\s+/g, "");  // strip leading spaces

                if(pwd !=  rpwd)
                {
                alert("Your password does not match! Try Again.");

                document.getElementById("password").value = "";
                document.getElementById("repeatpassword").value = "";
                document.getElementById("password").focus();
                }
                else
                {
                alert('Password matches.'); 
                }  
                }
                </script>



<script type="text/javascript">
function numbersonly(e,length)
{
var unicode=e.charCode? e.charCode : e.keyCode
var maxlength=length;
if (unicode!=8)
{ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
return false //disable key press
}
}
</script>
                    <script type="text/javascript">
                    $(document).on('keydown', '#password', function(e) {
                        if (e.keyCode == 32) return false;
                    });
                    $(document).on('keydown', '#repeatpassword', function(e) {
                        if (e.keyCode == 32) return false;
                    });
                    </script>

<script type="text/javascript">  
var reg = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/; 
function PhoneValidation(phone)
{
var OK = reg.exec(phone.value);  
if (!OK)  
window.alert("phone number isn't  valid");  
else
window.alert("Valid");
}  
</script>           
                        <script type="text/javascript">
                        $(document).ready(function () {
                        $("#phone").blur(function () {
                        var phone = $(this).val();
                        if (phone == '') {

                        }
                        else{
                        $("#availability").html('<img src="loader.gif">&nbsp;Checking availability.');
                        $.ajax({
                        url: "phonevalid.php?uphone="+phone
                        }).done(function( data ) {
                        $("#availability").html(data);
                        });   
                        } 
                        });
                        });
                        </script> 


<style type="text/css">

body {
background-image:url('images/reg3.jpg');
background-size: 1400px 700px;
background-repeat: no-repeat;
}
</style>                
</head>
<body>
<div align="center">
<h3>User Registration</h3>
<table>
<form name="register" action="save.php" method="post" onSubmit="return(validate());" o>
<tr>
<td>
<label>Name</label></td>
<td><label>:</label>
<input type="text" name="name" id="name" placeholder="Name"/><br /><br />
<div id="availability"></div></td></tr>
<tr><td>
<label>Email</label></td>
<td><label>:</label>
<input type="email" name="email" id="email" placeholder="Email" onChange="return checkEmail()" /><br /><br />
<div id="availability"></div></td></tr>
<tr><td>
<label>Password</label></td>
<td><label>:</label>
<input type="password" name="password" id="password" placeholder="Password" onBlur="focusPassword()"/><br /><br></td></tr>
<tr><td>
<label>RepeatPassword</label></td>
<td><label>:</label>
<input type="password" name="repeatpassword" id="repeatpassword" placeholder="RepeatPassword" onBlur="checkPassword()"/><br /><br />
</td></tr>
<tr><td>
<label>Date of Birth</label></td>
<td><label>:</label>
<select name="day" >
<option value="">Day</option>
<?php for ($day = 1; $day <= 31; $day++) { ?>
<option value="<?php echo strlen($day)==1 ? '0'.$day : $day; ?>"><?php echo strlen($day)==1 ? '0'.$day : $day; ?></option>
<?php } ?>
</select>

<select name="month" >
<option value="">Month</option>
<?php for ($month = 1; $month <= 12; $month++) { ?>
<option value="<?php echo strlen($month)==1 ? '0'.$month : $month; ?>"><?php echo strlen($month)==1 ? '0'.$month : $month; ?></option>
<?php } ?>
</select>

<select name="year" >
<option value="">Year</option>
<?php for ($year = date('Y'); $year > date('Y')-100; $year--) { ?>
<option value="<?php echo $year; ?>"><?php echo $year; ?></option>
<?php } ?>
</select>

<br /><br /><!--<input type="date" id="date" name="date" required><br /><br />-->
</td></tr>
<tr><td>
<label>Phone</label></td>
<td><label>:</label>
<input type="text" name="phone" id="phone" placeholder="Phone No" maxlength="10" onKeyPress="return numbersonly(event);PhoneValidation(this)"/><br /><br /><div id="availability"></div></td></tr>

 <tr><td>
<input type="submit" name="submit" value="Register" onClick="return checkName()"/></td>
<td><a href="login.php"> Already a member</a></td></tr>
</form>
</div>
</table>
<div align="right">
<div class="footer">
Copyright &copy; <?php echo date('Y');?><a href="http://micandmac.in/" target="_blank">micandMac</a>
</div>
</div>
</div>
</body>
</html>


 when I`m inserting it inserts all the values except phone number. In phone number it accepts 10 numbers, its my limit, like 1234567890, but 
 not accepting like 7894563021.
What is the problem? in my code

if i give 10 numbers like 7896302145 it saves 2147483647 for all what ever I`m giving

Edited by AntonyRayan: nil

2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by broj1
2

Haven't studied your code closely but the number 2147483647 is exactly the max integer value on 32 bit systems. Why do you not handle your phone number as a string?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.