Posts

Showing posts from December, 2016

CRUD operation with ajax functions

Image
Hear we show a basic CRUD operation with database with ajax function. Points : Connection with database  HTML form page Ajax function  JavaScript Insert data Update data Delete data View data First create one PHP file call connect.php  in this file contain a connection of database and this file call in other file for connecting with database. <?php $con=mysqli_connect("server name","username","password","databasename") or die(''.mysql_error()); ?> Now we create second file that include HTML of form and javascript. Create file name index.php <html>     <head>         <meta charset="UTF-8">         <title>test form</title>         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>     </head>     <body>         <form onsubmit="return false&q

How to set self page in form action?

In PHP some developer use same page for code and some use separate page for code of PHP script.so who use same page to script, they set page path in form tag as action.for that not set every time path of page use common code to put path of page. htmlspecialchars($_SERVER["PHP_SELF"]);  This code put in action attribute of form tag. this get current page path directly. For ex. <form name="test"  action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" >                    //Your code </from>