Posts

Showing posts from November, 2021

Ajax Depented Dropdown

  Ajax Depented Dropdown (PHP) index.php <?php     $conn = mysqli_connect("localhost","root","","dropdown_list");        if ($_SERVER['REQUEST_METHOD'] == "POST") {        $country_dropdown = $_REQUEST['country_dropdown'];        $state_dropdown = $_REQUEST['state_dropdown'];        $dist_dropdown = $_REQUEST['dist_dropdown'];        $enter_population = $_REQUEST['enter_population'];        $btn = $_REQUEST['btn'];            $query = mysqli_query($conn, "INSERT INTO population_table (country_dropdown,state_dropdown,city_dropdown,total_population) VALUES ('$country_dropdown','$state_dropdown','$dist_dropdown','$enter_population')");            if ($conn->affected_rows > 0) {                echo "<script>alert('Submited successfully')...

SOAP API CODE PHP

 Service: <?php  class server{ private $con; public function __construct() {     $this->con=(is_null($this->con))?self::connect():$this->con; } static function connect(){ $con=mysqli_connect("localhost","root","","csm_server_soap"); return $con; } public function getUserInfo($id_array){ $userid = $id_array["userid"]; // $result = mysqli_query($this->con,"select * from usermaster where userid = '$userid'"); // $info = mysqli_fetch_assoc($result); // return $id_array; return "lkkmjoiuh8yth"; } } $params = array('uri'=>'http://localhost:8181/csm/soap/server.php'); $server = new SoapServer(null,$params); $server -> setClass('server'); $server -> handle();  ?> Client: <?php  class client {     public function __construct()     {       $params = array('location'=>'http://localhost:8181/csm/soap/server.php...

Stored Procedure SQL Crud oparetion in PHP (WORKBENCH)

  Stored Procedure Create:  Workbench Code: CREATE DEFINER=`root`@`localhost` PROCEDURE `crud_oparation`(`ids` INT(11),`username` VARCHAR(100),`address` VARCHAR(100),`phone` VARCHAR(100),`StatementType` VARCHAR(20)) BEGIN IF StatementType = 'insert' THEN     BEGIN INSERT INTO store_proce_demo (id,                         username,                         address,                         phone)  VALUES  (ids,                         username,                         address,                         phone); END;     end if; IF StatementType = 'select' THEN BEGIN ...

JavaScript Form Validation Code

 <html>    <head>       <title>Javascript All At Once Validation</title>       <script>          function validate(){          var eid=document.getElementById("eid");          var ename=document.getElementById("ename");          var epass=document.getElementById("epass");          var ecpass=document.getElementById("ecpass");          var eadd=document.getElementById("eadd");          var ecity=document.getElementById("ecity");          var epin=document.getElementById("epin");          var eemail=document.getElementById("eemail");          if(notEmpty(eid,"Employee ID Should Not Be Blank"))          {           if(o...

PDO Format CRUD Oparetion in PHP

 conn.php <?php $servername = "localhost"; // $port = 3306; $username = "root"; $password = ""; try {     $conn = new PDO("mysql:host=$servername;dbname=crud_oparetion", $username, $password);   // set the PDO error mode to exception   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);   echo "Connected successfully"; } catch(PDOException $e) {   echo "Connection failed: " . $e->getMessage(); } ?> index.php <?php  include "conn.php"; if ($_SERVER['REQUEST_METHOD'] == "POST") {     $name = $_REQUEST['name'];     $address = $_REQUEST['address'];     $phone = $_REQUEST['phone']; // exit; $sql = $conn->prepare("INSERT INTO tab (name, address, phone) VALUES (? ,? ,?)"); $sql->bindParam(1, $name, PDO::PARAM_STR); $sql->bindParam(2, $address, PDO::PARAM_STR); $sql->bindParam(3, $phone, PDO::PARAM_STR); $sql->execute(); } ?> ...