Posts

Showing posts from November, 2020

Form Validation in Pure JS using Form Element Name

 In this post you will learn how to get value from form elements and how to validate whether it filled or not and selected or not . We are trying to show you all basic tags with validation . <!DOCTYPE html> <html> <head>     <title></title> </head> <body>     <h1>Pure Javascript Form Validation using form Element Name</h1>     <form name="myform">         <table align="center" border="30">             <tr>             <td>Gender</td>             <td>                 <input type="radio" name="gender" value="Female" />&nbsp;&nbsp;Female &nbsp;&nbsp;             ...

How to take photo from mobile camera and upload it using php ?

 First we write front end code : - <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             }         ...

How to take photo from camera and its preview in Jquery Mobile ?

 Here you will get code for preview of image captured by your device.   <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {                 width: 80%; max-width: 300px;             ...

how to upload file in jquery mobile using php ?

 First of all we need a folder to store uploaded file . Here I have upd named folder but its your choice to whatever you can named it . below is working code for file upload in jquery mobile . <!DOCTYPE html> <html> <head>     <title>jQM input file capture</title>     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css" />     <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>     <script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script> </head> <body>     <div data-role="page" id="page">         <style>             #preview {          ...

How to upload file in core php ?

 Create any file name but care about its extension should be .php    <!DOCTYPE html> <html>     <head>         <title>File Upload</title>     </head>     <body>         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">             <input type="file" name="csv_file">             <input type="submit" name="submit">         </form>         <?php         if (isset($_POST['submit'])) {             echo "<p>" . $_POST['csv_file'] . " => file input successfull</p>"; ...

MySQL date format DD/MM/YYYY select query?

  You can use STR_TO_DATE() to convert your strings to MySQL date values and ORDER BY the result: ORDER BY STR_TO_DATE(datestring, '%d/%m/%Y') However, you would be wise to convert the column to the DATE data type instead of using strings.

How to upload a project to Github ?

Here is how you would do it in Windows: If you don't have git installed, see this article on how to set it up. Open up a Windows command prompt. Change into the directory where your source code is located in the command prompt. First, create a new repository in this directory git init . This will say "Initialized empty git repository in ....git" ( ... is the path). Now you need to tell git about your files by adding them to your repository. Do this with git add filename . If you want to add all your files, you can do git add . Now that you have added your files and made your changes, you need to commit your changes so git can track them. Type git commit -m "adding files" . -m lets you add the commit message in line. So far, the above steps is what you would do even if you were not using github. They are the normal steps to start a git repository. Remember that git is distributed (decentralized), means you don't need to have a "central serv...

How to protect a class by an object creation by another class?

Answer : By making a constructor to private . Example :                      Class Dinesh                 { private Dinesh(){                 // Code will be here                        } }  

How to protect a class to be inherited ?

  Answer : By adding a final keyword in before class name . Example :                                  Class final Class_name                          { Code will be here }

Code for Google Translator for Website with Indian Languages

Paste this code onto your website Copy and paste the following code snippets onto every page you want to translate Place this meta tag before the closing </head>:- ————————————————————————————- <meta name=”google-translate-customization” content=”76732106efc70d8b-05ad2fc8af3e500b-ge0b18d68b0571536-16″ /> ————————————————————————————– Place this snippet where you’d like to display the Website Translator plugin on your page:- ————————————————————————————- <div id=”google_translate_element”></div><script type=”text/javascript”> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: ‘en’, includedLanguages: ‘bn,en,gu,hi,kn,pa,ta,te,ur’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, ‘google_translate_element’); } </script><script type=”text/javascript” src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>  

how to take backup of mysql database using php ?

  $dbhost = $_SERVER[ 'SERVER_NAME' ]; $dbuser = 'root' ; $dbpass = '' ; $dbname = 'marketing' ; $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $backupAlert = '' ; $tables = array (); $result = mysqli_query($connection, "SHOW TABLES" ); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); } else { while ($row = mysqli_fetch_row($result)) { $tables[] = $row[ 0 ]; } mysqli_free_result($result); $return = '' ; foreach ($tables as $table) { $result = mysqli_query($connection, "SELECT * FROM " . $table); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); ...

How to display errors in PHP file?

If you are getting no error but your desired result is not coming . Then may be the reason of php setting in your server . In server there is a file named php.ini   . In that file error display setting is available . You just need to do according to below code . ini_set ( 'display_errors' , 1 ); ini_set ( 'display_startup_errors' , 1 ); error_reporting ( E_ALL );

How to make pure CSS pop up box

<html> <head> <style> .modalDialog {     position: fixed;     font-family: Arial, Helvetica, sans-serif;     top: 0;     right: 0;     bottom: 0;     left: 0;     background: rgba(0, 0, 0, 0.8);     z-index: 99999;     opacity:0;     -webkit-transition: opacity 400ms ease-in;     -moz-transition: opacity 400ms ease-in;     transition: opacity 400ms ease-in;     pointer-events: none; } .modalDialog:target {     opacity:1;     pointer-events: auto; } .modalDialog > div {     width: 400px;     position: relative;     margin: 10% auto;     padding: 5px 20px 13px 20px;     border-radius: 10px;     background: #fff;     background: -moz-linear-gradient(#fff, #999);     background: -webkit-linear-gradient(#fff, #999);...

how to take backup of mysql database using php

$dbhost = $_SERVER[ 'SERVER_NAME' ]; $dbuser = 'root' ; $dbpass = '' ; $dbname = 'marketing' ; $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $backupAlert = '' ; $tables = array (); $result = mysqli_query($connection, "SHOW TABLES" ); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); } else { while ($row = mysqli_fetch_row($result)) { $tables[] = $row[ 0 ]; } mysqli_free_result($result); $return = '' ; foreach ($tables as $table) { $result = mysqli_query($connection, "SELECT * FROM " . $table); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); ...