PHP Practicalbookljcca
PHP Practicalbookljcca
What is PHP?
▪ PHP stands for PHP: Hypertext Preprocessor
▪ PHP is a server-side scripting language
▪ PHP scripts are executed on the server
▪ PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid,
PostgreSQL, Generic ODBC, etc.)
▪ PHP is open source software
▪ PHP is free to download and use
What is XAMPP?
XAMPP is an open source cross platform web server, MySQL database engine, and
PHP and Perl package. It is compiled and maintained by apache. The acronym
XAMPP stands for;
• htdocs; this is the web root directory. All of our PHP codes will be placed in
this directory.
• mysql – this directory contains all the information related to MySQL database
engine, by default it runs on port 3306.
• php – this directory contains PHP installation files. It contains an important
file named php.ini. This directory is used to configure how PHP behaves on
your server.
By default, the Apache web server runs on port 80. If port 80 is taken by another
web server, you can use a different port number.
Netbeans IDE
Dreamweaver
PHP Eclipse
Notepad ++
Go to htdocs folder which is present in the xampp installed folder. There create a folder of yours
“MyPHPProgram” and save this program with .php extension such as Hello.php.
Comments in PHP
▪ // Single line comment (C++ and Java-style comment)
▪ # Single line comment (Shell-style comments)
▪ /* Multiple line comment (C-style comments) */
PHP is a loosely typed language; it does not have explicit defined data types. PHP
determines the data types by analyzing the attributes of data supplied. PHP
implicitly supports the following data types
<?php
$a = 25; // Numerical variable
$b = ‘Hello‛; // String variable
$c = 5.7; // Float variable
echo ‘Number is : ‛.$a.‚<br/>‛;
echo ‘String is : ‛.$b.‚<br/>‛;
echo ‘Float value : ‛.$c;
?>
</body>
<html>
Number is : 25
String is : Hello
Float value : 5.7
Variable y is:
Example:
echo 50;
print (50);
<html>
<body>
<?php
// defining constant value PI = 3.14
define("PI","3.14");
$radius=15;
$area=PI*$radius*$radius;
echo "Area=".$area;
?>
</body>
</html>
Area=706.5
Arithmetic Operators
Arithmetic operators allow performing basic mathematical operations
Operator Description Example Result
+ Addition $a = 2 + 5; $a=7
- Subtraction $a = 10 - 2; $a=8
* Multiplication $a = 2 * 5; $a=10
/ Division $a = 15 / 5; $a=3
% Modulus $a = 23 % 7; $a=3.28
++ Increment $a =5; $a=6
$a ++;
-- Decrement $a =5; $a=4
$a --;
Suppose you are developing a website that contains the same navigation menu
across all the pages.
You can create a common header then include it in every page using the include
statement.
<?php
include 'file_name';
?>
Example
Code of “header.php”
<a href=”/index.php”>HOME</a>
<a href=”/contact”>CONTACT</a>
<a href=”/faq.php”>FAQs</a>
Code of “index.php”
<?php
Include “header.php”;
?>
Require_once is ignored if the required file has already been added by any of the four
include statements.
Example
config.php
Code of “config.php”
<?php
$config['host'] = 'localhost';
$config['db'] = 'my_database';
$config['uid'] = 'root';
$config['password'] = '';
?>
Code of “index.php”
<?php
Require “config.php”;
?>
The if Statement in PHP
If statement executes some code only if a specified condition is true
Syntax:
if (condition) { code to be executed if condition is true; }
Syntax:
if (condition)
{
code to be executed if condition is true;
}
else
{
code to be executed if condition is false;
}
Syntax:
if (condition)
{
code to be executed if condition is true;
}
elseif (condition)
{
code to be executed if condition is true;
}
else
{
code to be executed if condition is false;
}
Switch Statement in PHP
Switch statement selects one from multiple blocks of code to be executed
Syntax:
switch (n)
{
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
...
default:
Syntax:
for (initialization; test condition; increment/decrement)
{
code to be executed;
}
Syntax:
do
{
code to be executed;
} while (condition );
User Defined Function in PHP
Functions are group of statements that can perform a task
Syntax:
function functionName()
{
code to be executed;
}
Break statement
Break statement is used to terminate the loop
After the break statement is executed the control goes to the statement immediately after the loop
containing break statement
else
echo “$i”;
}
?>
</body>
</html>
<?php
$student=array(
array(1,"Mr. A"),
array(2,"Mr. B"),
array(3,"Mr. C"));
foreach ($student as $key => $i)
{
echo "$key =>";
foreach ($i as $j)
{
echo " $j";
}
echo "</br>";
}
?>
Ix Reverse Number
for($i=0;$i<count($a);$i++)
{
if($a[$i]%2==0)
$sume += $a[$i];
else
$sumo += $a[$i];
}
if($sumo==0)
echo "there are no odd numbers in the array <br>";
else
echo "sum of odd numbers : $sumo
<br>";if($sume==0)
echo "there are no even numbers in the array
<br>";
else
echo "sum of even numbers : $sume";
?>
<?php
$a = array(2,4,1,54,76,2,17,76,1);
$l=0;
for($i=0;$i<count($a);$i++)
{
if($l<$a[$i])
$l=$a[$i];
}
echo "$l is the largest number
<br>";for($i=0;$i<count($a);$i++)
{
if($l>$a[$i])
$l=$a[$i];
}
echo "$l is the smallest number ";
?>
<?php
//using for loop
$sub=array("english","hindi","maths","science","art");
for($i=0;$i<5;$i++)
{
echo"$sub[$i]<br>";
}
?>
Function joinstrings($a,$b)
{
$c=$a." ".$b;
return $c;
}
$a= "welcome";
$b = "good morning";
Echo
joinstrings($a,$b);
?>
Function joinstrings()
{
$a = "Welcome";
$b = "Good Morning ";
$c = $a ." " .
$b;return $c;
}
echo joinstrings();
?>
<?php
$myArray=array(22,34,12,9,10,5);
rsort($myArray);
for($i=0;$i<count($myArray);$i++)
echo "$myArray[$i]<br>";?>
What is MySQL?
MySQL is an open-source relational database management system (RDBMS). It is the most
popular database system used with PHP.
• The data in a MySQL database are stored in tables which consists of columns and rows.
• MySQL is a database system that runs on a server.
• MySQL is ideal for both small and large applications.
• MySQL is very fast, reliable, and easy to use database system.It uses standard SQL
• MySQL compiles on a number of platforms.
mysqli_connect():
The mysqli_connect() function in PHP is used to connect you to the database.
Example
<?php
mysqli_connect("localhost", "root", "", "DB_1");
if(mysqli_connect_error())
echo "Connection Error.";
else
echo "Database Connection Successfully.";
?>
mysql_select_db():
mysql_select_db to select a database. It returns TRUE on success or FALSE on failure.
Example
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$conn = mysqli_connect($host, $user, $pass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
mysqli_close($conn);
?>
mysql_query():
Perform query against a database. The results that are returned are stored in the
variable $result.
<?php
$con = mysqli_connect("localhost","root","","DB_1");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
// Perform query
if ($result = mysqli_query($con, "SELECT * FROM Emp"))
{
echo "Returned rows are: " . mysqli_num_rows($result);
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
mysqli_num_rows
Return the number of rows in a result set
Example
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
echo “Total Rows : “ . $rowcount;
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
mysqli fetch_array()
Fetch a result row as a numeric array and as an associative array.
<?php
$con=mysqli_connect("localhost","root","","DB_1");
if (mysqli_connect_errno()) {
while($row = mysqli_fetch_array($result))
{
Echo “No : “. $row[Eno] ;
Echo “Name : “. $row[Ename].”</br>”;
}
mysqli_close($con);
?>
mysqli affected_rows
Return the number of affected rows from different queries.
<?php
$con = mysqli_connect("localhost","root","","DB_1");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
mysqli_close($con);
?>
UNIT 2 PROGRAMS
1. Create a form containing two input fields (Name, Email_ID) and a submit button. When the
user clicks on submit button, the form data should be sent for processing to PHP file ,which
should display the welcome message with the email_id on the PHP page. Form data should
be sent by HTTP GET/POST method.
<html>
<body>
<form action="v1.php" method="post">
<input type="text" name="name"><br>
<input type="email" name="email"><br>
<input type="submit" name="submit"><br>
</form>
</body>
</html>
IN v1.php
<?php
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo"connection successful<br>";
$id=$_POST["pid"];
$qry=mysqli_query($con,'DELETE FROM product WHERE pro_id='.$id);
$result=mysqli_affected_rows($con);
if($result==1)
echo "record deleted successfully";
else
echo "could not delete";
mysqli_close($con);
?>
2. .Write a PHP script for that creates a database named "DB-1"in MySQL.
<?php
$con=mysqli_connect("localhost","root","");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo "connection successful<br>";
if($qry)
echo "db success";
else
echo "db error".mysqli_error($con);
mysqli_close($con);
?>
3. Write a PHP script for creating a product table in the specified database with fields Pro_id,
Pro_name, Pro_price, QOH. Also display an acknowledgement for the same.
<?php
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo "connection successful<br>";
<html>
<body>
<form action="v4.php" method="post">
product id : <input type="text" name="pid"><br>
product name : <input type="text" name="pname"><br>
product price : <input type="text" name="pprice"><br>
quantity : <input type="text" name="qoh"><br>
<input type="submit" name="submit"><br>
</form>
</body>
</html>
IN v4.php
<?php
if(isset($_POST))
{
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect :'.mysqli_connect_error());
echo "connection successful<br>";
$id=$_POST["pid"];
$pn=$_POST["pname"];
$pr=$_POST["pprice"];
$qh=$_POST["qoh"];
<html>
<body>
<form action="v5.php" method="post">
Product ID : <input type="text" name="pid"><br>
<button type="submit">Search</button>
</form>
</body>
</html>
IN v5.php
<?php
if(isset($_POST))
{
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo "connection successful<br>";
$id=$_POST["pid"];
$qry=mysqli_query($con,'SELECT * FROM product WHERE pro_id='.$id);
if(mysqli_num_rows($qry)>0)
{
while($row=mysqli_fetch_array($qry))
{
echo "product id :{$row['Pro_id']}<br>".
"product name :{$row['Pro_name']}<br>".
"product price:{$row['Pro_price']}<br>".
"quantity on hand:{$row['QOH']}<br>";
}
}
else
echo "no record found";
mysqli_close($con);
}
?>
6. Create a form contaning two input fields (Pro_id, QOH) and Update button. When the
user clicks on the Update button the quantity of the Pro_id specified should get updated
using a PHP script.
<html>
<body>
<form action="v6.php" method="POST">
Product ID : <input type="text" name="pid"><br>
Quantity : <input type="text" name="qoh"><br>
<button type="submit">UPDATE</button>
</form>
</body>
</html>
IN v6.php
<?php
if(isset($_POST))
{
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo "connection successful<br>";
$id=$_POST["pid"];
$qh=$_POST["qoh"];
$qry=mysqli_query($con,'UPDATE product SET QOH='.$qh.' WHERE Pro_id='.$id);
$result=mysqli_affected_rows($con);
if($result==1)
echo"record updated successfully";
else
echo"could not update".mysqli_error($con);
mysqli_close($con);
}
else
echo"no entry found";
?>
7. Create a form contaning one input field(Pro_id) and a Delete button. When the user clicks
on the Delete button a PHP script should get executed and should delete the record of
the product for the Pro_id specified.
<html>
<body>
<form action="v7.php" method="POST">
Product ID : <input type="text" name="pid"><br>
<button type="submit">delete</button>
</form>
</body>
</html>
IN v7.php
<?php
$con=mysqli_connect("localhost","root","","db_1");
if(!$con)
die('could not connect:'.mysqli_connect_error());
echo"connection successful<br>";
$id=$_POST["pid"];
$qry=mysqli_query($con,'DELETE FROM product WHERE pro_id='.$id);
$result=mysqli_affected_rows($con);
if($result==1)
echo "record deleted successfully";
else
echo "could not delete";
mysqli_close($con);
?>
UNIT 3
AJAX
AJAX is not a programming language but it is set of technologies to create fast responsive
webpages. No Page Reload / Refresh is done by using AJAX bcoz it does not load whole
page.
AJAX allows web pages to be updated asynchronously by exchanging small amounts of data
with the server behind the scenes. This means that it is possible to update parts of a web
page, without reloading the whole page.
>>>>>>>INSHORT
It (AJAX) does this by updating only part of a web page rather than the whole page. The
asynchronous interactions are initiated by JavaScript.
The purpose of AJAX is to exchange small amounts of data with server without page refresh.
JavaScript is a client side scripting language. It is executed on the client side by the web
browsers that support JavaScript. JavaScript code only works in browsers that have
JavaScript enabled.
• Validation can be performed done as the user fills in a form without submitting it.
This can be achieved using auto completion. The words that the user types in are
submitted to the server for processing. The server responds with keywords that
match what the user entered.
• It can be used to populate a dropdown box depending on the value of another
dropdown box
• Data can be retrieved from the server and only a certain part of a page updated
without loading the whole page. This is very useful for web page parts that load
things like
• Tweets
• Users visiting the site etc.
ABOUT XMLHttpRequest
2. xhttp.open(method, URL, true) …. True for async and false for sync OEN()
method specifies the main parameters of the request:
method – HTTP-method. Usually "GET" or "POST". URL – the URL to request, a string, can be
URL object.
This method just place the request.
Property Description
onreadystatechanDefines a function to be called when the readyState property changes
ge
readyState Holds the status of the XMLHttpRequest. 0: request not initialized
(initial state)
1: server connection established ( open() is called) 2: request received
3: processing request (response is loading means data packets are
received) 4: request finished and response is ready (complete status
with data)
Status 200: "OK"
403: "Forbidden" 404: "Page not found"
statusText Returns the status-text (e.g. "OK" or "Not Found")
The onreadystatechange property defines a function to be executed when the readyState
changes. The status property and the statusText property hold the status of the
XMLHttpRequest object.
The onreadystatechange function is called every time the readyState changes. When
readyState is 4 and status is 200, the response is ready:
1. .html
2. .ajax
3. .php
1. Create a form containing one input field (Name). When the user enters his/her name and
as any key is released , the form should display a welcome message for the user.
Implement using AJAX.
<html>
<head>
<script src="j1.js"></script>
</head>
<body>
Enter string : <input type="text" id="txtname" onkeyup="showdata();">
<div id="info"></div>
</body>
</html>
IN j1.js
function showdata()
{
var xmlhttp = new XMLHttpRequest();
var str = document.getElementById("txtname").value;
xmlhttp.open("GET","j1.php?q=" + str , true);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
document.getElementById("info").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j1.php
<?php
$n = $_GET["q"];
echo "Welcome user :".$n;
?>
2. .Repeat the above question to demonstrate the use of keydown and keypress events.
<html>
<head>
<script src="j1.js"></script>
</head>
<body>
Enter string : <input type="text" id="txtname" onkeydown="showdata();">
<div id="info"></div>
</body>
</html>
IN j1.js
function showdata()
{
var xmlhttp = new XMLHttpRequest();
var str = document.getElementById("txtname").value;
xmlhttp.open("GET","j1.php?q=" + str , true);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
document.getElementById("info").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j1.php
<?php
$n = $_GET["q"];
echo "Welcome user :".$n;
?>
<html>
<head>
<script src="j2.js">
</script>
</head>
<body>
Enter string : <input type="text" id="txtname" onkeypress="showdata();">
<div id="info"></div>
</body>
</html>
IN j2.js
function showdata()
{
var xmlhttp = new XMLHttpRequest();
var str = document.getElementById("txtname").value; xmlhttp.open("GET","j2.php?q=" +
str , true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4)
{
document.getElementById("info").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j2.php
<?php
$n = $_GET["q"];
echo "Welcome user :".$n;
?>
3. Write a program for converting a string into uppercase using AJAX.
<html>
<head>
<script src="j3.js"></script>
</head>
<body>
Enter string : <input type="text" id="txtname"><br>
Result string : <input type="text" id="txtresultname"></br>
<input type="submit" name="submit" onclick="showdata();">
</body>
</html>
IN j3.js
function showdata()
{
var xmlhttp = new XMLHttpRequest();
var str = document.getElementById("txtname").value;
xmlhttp.open("GET","j3.php?q=" + str , true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4)
{
document.getElementById("txtresultname").value = xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j3.php
<?php
$n = $_GET["q"];
$n1 = strtoupper($n);
echo $n1;
?>
4. Create a form contaning a combobox with some product names as items. Whenever a
user selects a particular product from the combox, it shuold be sent to the server
asynchronously (i.e. without pressing submit button). Implement using AJAX.
<html>
<head>
<script src="j4.js"></script>
</head>
<body>
<select id="cmboptions" onchange="showdata();">
<option>English</option>
<option>Science</option>
<option>Hindi</option>
</select>
<div id="info"></div>
</body>
</html>
IN j4.js
function showdata()
{
var xmlhttp = new XMLHttpRequest();
var str = document.getElementById("cmboptions").value;
xmlhttp.open("GET","j4.php?q=" + str , true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4)
{
document.getElementById("info").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j4.php
<?php
$n = $_GET["q"];
echo "You selected : " . $n;
?>
5. Write a program to demonstrate the example of sending items selected from radio and
checkbox to server asynchronously.
CHECKBOX
<html>
<head>
<script src="j5c.js"></script>
</head>
<body>
<input type="checkbox" name="product" value="Monitor"/>Monitor<br />
<input type="checkbox" name="product" value="Keyboard"/>Keyboard<br />
<input type="checkbox" name="product" value="CPU"/>CPU<br />
<input type="checkbox" name="product" value="Wires"/>Wires<br />
<input type="button" name="g" value="Click" onclick="getselecteditems()"
/><br />
<h1 id="info"></h1>
</body>
</html>
IN j5c.js
function getselecteditems ()
{
var xmlhttp = new XMLHttpRequest();
var r=document.getElementsByName("product");
var product="";
for(var i=0;i<r.length;i++)
{
if(r[i].checked==true)
{
product+=r[i].value+" ";
}
}
xmlhttp.open('GET','j5c.php?checkselect='+product,true);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 &&xmlhttp.status==200)
{
document.getElementById("info").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j5c.php
<?php
$r=$_GET['checkselect'];
$str=explode(" ",$r);
echo "<br>";
echo "total items selected ".count($str);
echo "<br>";
for($i=0;$i<count($str);$i++)
{
echo "Selected item is : ".$str[$i]."<br>";
}
if($r=="")
{
<html>
<head>
<script src="j5r.js"></script>
</head>
<body>
<input type="radio" name="product" value="Mouse" onclick="selection()"
/>Mouse<br/>
<input type="radio" name="product" value="CPU" onclick="selection()"
/>CPU<br />
<input type="radio" name="product" value="Keyboard"
onclick="selection()"/>Keyboard<br />
<h1 id="info"></h1>
</body>
</html>
IN j5r.js
function selection()
{
var xmlhttp=new XMLHttpRequest();
var r=document.getElementsByTagName('input');
var product;
for(var i=0;i<r.length;i++)
{
if(r[i].type == "radio" && r[i].checked)
{
product =r[i].value;
}
}
xmlhttp.open('GET','j5r.php?radioselect='+ product,true);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 &&xmlhttp.status==200)
{
document.getElementById("info").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.send();
}
IN j5r.php
<?php
$r=$_GET['radioselect'];
if($r=="")
{
echo "you have not selected any item";
}
else
{
echo "you have selected <u><i>". $r."</i></u>";
}
?>
6. Write a program to validate a blank field and also validate the length
of the data entered(i.e. minimum lenght of 5).
<html>
<head>
<script src="j6.js"></script>
</head>
<body>
Enter string <input type="text" id="strstring" >
<input type="submit" name="submit" onclick="checkString();">
<div id="info"></div>
</body>
</html>
IN j6.js
function checkString()
{
IN j6.php
<?php
$str=$_GET["q"];
$n = strlen($str);
echo "length of string is ".$n."<br>";
if ($str=='' || $n <5)
{
echo "String is empty OR string should have minimum 5 characters";
}
else
{
echo "String is : " . $str;
}
?>
7. Write a programto validate and Email ID using regular expression
and by using DOM.
<html>
<head>
<script src="j7.js"></script>
</head>
<body>
Enter Email Id : <input type="text" id="emailid">
<input type="submit" name="submit" onclick="checkemail();">
<div id="info"></div>
</body>
</html>
IN j7.js
function checkemail()
{
var strEmail = document.getElementById("emailid").value;
var a= /^[a-zA-Z0-9_]+\@+[a-zA-Z]+\.[a-z]{2,3}$/;
if (a.test(strEmail)==true)
{
document.getElementById("info").innerHTML="Valid Email
Address";
}
else
{
document.getElementById("info").innerHTML="InValid Email
Address";
}
}
8. Write a program that checks a particular stuId already exits in the
student(stuId,stu_name,mob,country) table or not. If stuId exists
then display a message "User Already Exit. Try another stuId". If it
does not exits then add the data in the student table.Implement
using AJAX.
<html>
<head>
<script src="j8.js"></script>
</head>
<body>
Customer ID : <input type="text" id="custid"><br>
Customer Name : <input type="text" id="custname"><br>
Customer Mobile : <input type="text" id="custmob"><br>
Customer Country : <input type="text" id="custcon"><br>
<input type="submit" name="submit" onclick="cust();">
<div id="info"></div>
</body>
</html>
IN j8.js
function cust()
{
var xmlhttp = new XMLHttpRequest();
var cid = document.getElementById("custid").value;
var cname = document.getElementById("custname").value;
var cmob = document.getElementById("custmob").value;
var ccon = document.getElementById("custcon").value;
xmlhttp.open("GET","j8.php?v1="+cid+"&v2="+cname+"&v3="+cmo
b+"&v4="+ccon,true);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("info").innerHTML=xmlhttp.responseText
;
}
}
xmlhttp.send();
}
<?php
$conn = mysqli_connect("localhost","root","","db_1");
if(!$conn)
die('Could not connect: '.mysqli_connect_error());
echo 'Connected successfully<br/>';
$id=$_GET["v1"];
$name=$_GET["v2"];
$mob=$_GET["v3"];
$country=$_GET["v4"];
if($result==1)
echo "record successfully inserted";
else
echo "could not insert".mysqli_error($conn);
}
mysqli_close($conn);
?>