Tuesday, 7 July 2015

Complete code for mobile app sending data to php & php inserting that data to databse (A MOBILE APP SINGUP SYSTEM)

                                                    ( A MOBILE APP  SINGUP  SYSTEM)


1) SOURCE  CODE  OF  APP  SIDE :::---

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

    <script>

        $(document).on("pagecreate", "#pageone", function ()
        {
            $("li").on("swipe", function () {
                $(this).hide();
            });
            $(document).on("scrollstart", function () {
                alert("you started scroling!!");
            });
        });


       function checkLogin()
        {
            alert("abs");

            var aa = document.getElementById("name").value;
            var bb = document.getElementById("pass").value;
            alert(aa);
            alert(bb);

            var data =
            {
                user: aa,
                pass: document.getElementById("pass").value
            };

            $.getJSON("http://mapg.host22.com/mobileapp/insert.php?jsonp=?", data, function (data,status) {

                var status = JSON.stringify(data['status']);
                alert(data['status']);

                alert(status);              ////  how program works= status;
                alert(data);                /// all the echo of insert.php  is  data;   echo of insert.php= data;

            }
            );
        }
        
    </script>
</head>

<body>
    <div data-role="page" id="pageone">
        <div data-role="header">
            <h1>page 1</h1>
        </div>

        <div id="mess" >

        </div>

        <div data-role="main" class="ui-content">
            <p> LOGIN PAGE </p>
            Username : <input type="text" id="name" placeholder="your Name " />
            Password : <input type="password" id="pass" placeholder="your Password " />
            <input type="button" value="LOGIN" id="button" onclick="checkLogin()" />
            <input type="range" min="0" max="100" value="20" name="range_name" />
        </div>

        <div data-role="footer" data-position="fixed">
            <h1> &copy; Nikhil </h1>
        </div>

    </div>
</body>
</html>





-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
2) SOURCE CODE FOR PHP SIDE:

   <?php
 
$conn=mysql_connect($servername,$username,$password)
mysql_select_db($databasename,$conn);

//$function_name=$_GET['jsonp'];

$a=$_GET['user'];

$pwd=$_GET['pass'];

$query="insert into mobilecheck  values('','$a','$pwd')";
$result=mysql_query($query);


?>

No comments:

Post a Comment