Topic: Technology

Automatically Refresh/Reload Page using VueJS Example 0

Automatically Refresh/Reload Page using VueJS Example

Automatically Refresh/Reload Page using VueJS Example

In this Post We Will Explain About is Automatically Refresh/Reload Page using VueJS Example With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vue JS and Auto Page Refresh Example

In this post we will show you Best way to implement Auto refresh page refresher, automatically refresh using vuejs, hear for vuejs Automatically Refresh HTML page or div after some Interval with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Automatically Refresh a Page Using Vuejs

Vuejs simple example of the Automatically Refresh HTML page or div after some Interval

new Vue({ 
	el: 'live24u',

	data: {
	},

	ready: function() {
		this.mymsg();
	},

	methods: {
			    studentUpdate: function () {
                    this.$http.get('/webapi/student').then((results) => {
                        console.log(results.data.data);
                        this.student = results.data.data;
                    }, (results) => {
                        console.log('ERROR');
                        console.log(results);
                    });
                    setTimeout(this.studentUpdate, 5000);
                }
		},

})

Example 2 : Vue JS and Auto Page Refresh

simple make a page auto refresh or reload after a certain some x second amount of second

methods: {
	studentUpdate: function () {
		this.$http.get('/webapi/student').then((results) => {
			console.log(results.data.data);
			this.student = results.data.data;
		}, (results) => {
			console.log('ERROR');
			console.log(results);
		});
		setTimeout(this.studentUpdate, 5000);
	}
},
ready() {
	this.studentUpdate();
}

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is vuejs – How to reload page every 5 second And how it works.I would Like to have FeedBack From My Blog(live24u.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(live24u.com) Are Most Always Welcome.

Ajax Contact Form with Captcha reCAPTCHA v2/2.0 using PHP with jQuery 0

Ajax Contact Form with Captcha reCAPTCHA v2/2.0 using PHP with jQuery

Ajax Contact Form with Captcha reCAPTCHA v2/2.0 using PHP with jQuery

In this Post We Will Explain About is Ajax Contact Form with Captcha reCAPTCHA v2/2.0 using PHP with jQuery With Example and Demo.Welcome on pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to BOOTSTRAP RECAPTCHA FORM TUTORIAL Example

In this post we will show you Best way to implement Setting up reCAPTCHA 2.0 with AJAX Demo/Tutorial, hear for Ajax based reCAPTCHA v2 implementation using PHP with jQuery with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Why use reCAPTCHA?

->Google ReCAPTCHA is a Best or simple way to verify all the users are check real or not.

->Many other bots generally fake will look hard for your load side with dummy data contact Your forms that don’t any use google reCAPTCHA or simple an equivalent as well as send more any fake users thousands or more of send messages a second things through these your inquiry or contact forms.

->It can have very some negative some more effects for your websiter including your personl domain being data marked as message spam, being blocked mail from your gmail or any email server, and some many more things.

->With google reCAPTCHA, We add HTML PHP an extra layer of main best security by only users or humans allowing verified all the humans to HTML php server side HTML submit your form?

Send mail susscessfully with Google reCAPTCHA 2.0 with AJAX call

Crate api key

https://www.google.com/recaptcha/intro/index.html

url : https://www.google.com/recaptcha/admin

Paste this source code before the closing HTML head tag on your HTML template: Like this js libs

<script src='https://www.google.com/recaptcha/api.js'></script>

Paste this source code at the end of the main file html form tags where you want the google reCAPTCHA widget to appear: Ajax Contact Form with Captcha reCAPTCHA v2/2.0 using PHP with jQuery

<div class="g-recaptcha" data-sitekey="6LdHcFIUAKKKKJE2fuT2wFLz5UkjJ0ZNGOhDmW6x"></div>

index.html

simple source code to g-recaptcha add.

<!DOCTYPE HTML>
<head>
  <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
  <script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<!--=================================
contact from -->

<section class="page-section-ptb">
        <div class="container">
            <div class="row">
                <div class="col-md-8 col-md-offset-2">
                    <div class="contact-form-title text-center mb-40">
                        <h4 class="mb-15">We Love To Hear From You</h4>
                        <p>Please contact us pakainfo.com</p>
                    </div>
                </div>
                <div class="gray-form">
                    <div class="col-lg-12 col-md-12">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Company Name" id="comapny_name" name="comapny_name">
                        </div>
                    </div>
                    <div class="col-lg-12 col-md-12">
                        <div class="form-group">
                         <div class="selected-box">
                            <select class="form-control" name="sname" id="sname">
                                <option>Looking For</option>
                                <option>DevOps Managed Services</option>
                                <option>Cloud Services</option>
                                <option>Staffing Services</option>
                                <option>Training Services</option>
                                <option>Digital Marketing</option>
                                <option>Digital Transformation</option>
                            </select>
                         </div>
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="First Name" name="fname" id="fname">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Last name" name="lname" id="lname">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Official Email Id" name="email" id="email">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Phone" name="phone" id="phone">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Address" name="address" id="address">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="City" name="city" id="city">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Country" name="country" id="country">
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-6">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="Zip / Post code" name="zipcode" id="zipcode">
                        </div>
                    </div>
                    <div class="col-lg-12 col-md-12">
                        <div class="form-group">
                            <textarea class="form-control" rows="7" placeholder="Message" name="msg" id="msg"></textarea>
                        </div>
                    </div>
					 <div class="col-lg-12 col-md-12">
											<div class="form-group">
						<div class="g-recaptcha" data-sitekey="6LdnBE0UAAAAABp5QznSymoZWR2Hl4wd0rlJq9cP"></div>
					</div>
					</div>


                    <div class="col-lg-12 col-md-12">
                        <!--<a class="button" href="#">submit now</a>-->
                         <input type="submit" id="submit" class="button" value="submit now" name="frm_submit">
                    </div>
<br/><br/>
<div class="col-lg-12 col-md-12">
<div class='alert alert-success' id="msg_success" style="display:none;margin-top:15px;">
<button class='close' data-dismiss='alert'>×</button>
	Your contact request have submitted successfully.
</div>
</div>

<div class="col-lg-12 col-md-12">
<div class='alert alert-danger' id="capcha_error" style="display:none;margin-top:15px;">
<button class='close' data-dismiss='alert'>×</button>
	Robot verification failed, please try again.
</div>
</div>
                </div>
            </div>
            
        </div>
     
    </section>
	</body>
	</html>

NOTE: make almost sure to check replace Google Live YOUR_KEY as well as your set data-sitekey you simple website get from google reCAPTCHA.

Jquery source code

simple below jquery and javascript source code

<script>
$(document).ready(function(){
$("#submit").click(function(){


var comapny_name = $("#comapny_name").val();
var sname = $('#sname :selected').text();
var fname = $("#fname").val();
var lname = $("#lname").val();
var email = $("#email").val();
var phone = $("#phone").val();
var address = $("#address").val();
var city = $("#city").val();
var country = $("#country").val();
var zipcode = $("#zipcode").val();
var msg = $("#msg").val();


var captcha = grecaptcha.getResponse();
var dataString = 'comapny_name='+ comapny_name + '&sname='+ sname + '&fname='+ fname + '&lname='+ lname + '&email='+ email + '&phone='+ phone + '&address='+ address + '&city='+ city + '&country='+ country + '&zipcode='+ zipcode + '&msg='+ msg + '&captcha='+ captcha;

if(captcha=='')
{
	$("#capcha_error").show();
}
else
{
	// AJAX Code To Submit Form.
	$.ajax({
	type: "POST",
	url: "ajaxsubmit.php",
	data: dataString,
	cache: false,
	success: function(result){
		$("#msg_success").show();
		$("#submit").attr('disabled',true);
		$("#capcha_error").hide();
	//alert(result);
	}
	});
	
}
return false;

});
});
</script>

ajaxsubmit.php

here server side source code available.

<?php
//server side PHP source code
//print_r($_POST);
//die();
         $comapny_name = $_POST['comapny_name'];
         $sname= $_POST['sname'];

         $fname= $_POST['fname'];
         $lname= $_POST['lname'];
         $email= $_POST['email'];
         $phone= $_POST['phone'];
         $address= $_POST['address'];
         $city= $_POST['city'];
         $country= $_POST['country'];
         $zipcode= $_POST['zipcode'];
         $msg= $_POST['msg'];

$message = "
<html>
<head>
<title>CONTACT US</title>
</head>
<body>
<p>CONTACT US</p>
<table>
<tr>
<th>Company Name</th>
<td>".$comapny_name ."</td>
</tr>
<tr>
<th>service Name</th>
<td>".$sname."</td>
</tr>
<tr>
<th>First Name</th>
<td>".$fname."</td>
</tr>
<tr>
<th>Last Name</th>
<td>".$lname."</td>
</tr>
<tr>
<th>Email Address</th>
<td>".$email."</td>
</tr>
<tr>
<th>Phone</th>
<td>".$phone."</td>
</tr>
<tr>
<th>Address</th>
<td>".$address."</td>
</tr>
<tr>
<th>City</th>
<td>".$city."</td>
</tr>
<tr>
<th>Country</th>
<td>".$country."</td>
</tr>
<tr>
<th>zip code</th>
<td>".$zipcode."</td>
</tr>
<tr>
<th>Message</th>
<td>".$msg."</td>
</tr>
</table>
</body>
</html>
";



$email = "[email protected]"; //set your email address here
//$email = "[email protected]"; //set your email address here
$subject = "First mail for testing";// Put here Email Address subject

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";

$secret="YOUR_SECRET";
$response=$_POST["captcha"];

$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
$captcha_success=json_decode($verify);
if ($captcha_success->success==false) {
 echo "This user was not verified by recaptcha.";
}
else if ($captcha_success->success==true) {
  		//mail($email,$subject,$message,$headers);
		if(mail($email,$subject,$message,$headers)) {
		  echo "Form Submitted Succesfully";
		}

}		
		

?>

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is BotDetect PHP jQuery AJAX Contact Form CAPTCHA Code Example And how it works.I would Like to have FeedBack From My Blog(pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(pakainfo.com) Are Most Always Welcome.

Accessing Complex Nested JSON objects in VueJs 0

Accessing Complex Nested JSON objects in VueJs

Accessing Complex Nested JSON objects in VueJs

In this Post We Will Explain About is Accessing Complex Nested JSON objects in VueJs With Example and Demo.Welcome on pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Access to nested JSON property with vue.js Example

In this post we will show you Best way to implement Accessing Nested Objects in Vuejs, hear for Iterating Over nested Items in Vue.js With V-for with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Getting Started for Access to nested JSON property with vue.js

We have used CDN(libes) for Vuejs so you must need Your internet Data connection for them to work on Access to nested JSON property with vue.js.

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>

index.html

This is the main HTML view of our Simple Web Application. In here, we have init Base declared all our simple my this Example(Iterating Over nested Items in Vue.js With V-for) dependencies and the HTML Elements that we have created.

<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Iterating Over nested Items in Vue.js With V-for - pakainfo.com</title>
</head>
<body id="pakainfo">
<h2>Access nested JSON property with VueJS</h2>
<template v-for="all_students_list in live_schools">
  <tr>
       <td>{{all_students_list.view.name}}</td>
  </tr>
</template>
</body>
</html>

index.js

This contains our simple custom index.js files Add Like as javascript, vuejs scripts

///How to access nested data objects using vue?
var pakainfo = new Vue({
  el: '#pakainfo',
  data: {
    live_schools: [
   {
      "id":1,
      "student_id":1,
      "view_id":1,
      "schoolstd_id":1,
      "student_class_id":1,
      "stude_status":false,
      "view":{
         "id":1,
         "name":"Krunal Sisodariya",
         "schoolstd_id":1,
         "stude_status":false
      }
   },
   {
      "id":2,
      "student_id":1,
      "view_id":2,
      "schoolstd_id":1,
      "student_class_id":1,
      "stude_status":false,
      "view":{
         "id":2,
         "name":"Jaydeep Gondaliya",
         "schoolstd_id":1,
         "stude_status":false
      }
   },
   {
      "id":3,
      "student_id":1,
      "view_id":3,
      "schoolstd_id":1,
      "student_class_id":1,
      "stude_status":false,
      "view":{
         "id":3,
         "name":"Rakesh Bhanderi",
         "schoolstd_id":1,
         "stude_status":true
      }
   }
]
  }
})

Access nested JSON property with VueJS

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Accessing Nested Objects in Vuejs And how it works.I would Like to have FeedBack From My Blog(pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(pakainfo.com) Are Most Always Welcome.

How to Create a File Type Validation using PHP 0

How to Create a File Type Validation using PHP

How to Create a File Type Validation using PHP

In this Post We Will Explain About is How to Create a File Type Validation using PHP With Example and Demo.Welcome on pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php check file extension in upload form Example

In this post we will show you Best way to implement How to securely upload files with PHP, hear for How To Handle File Uploads With PHP with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Creating simple Form

first of all, we make simple HTML form which data contains simple file upload HTML input field.

Make a new simple file, name it Like as index.php and copy data & paste the source codes below.

<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>How to Make a File Type Validation using PHP</title>
	<link rel="stylesheet" type="text/css" href="pakainfo/bootstrap4/css/bootstrap.min.css">
</head>
<body>
<div class="pakainfo container">
	<h1 class="pakainfo text-center" style="margin-top:30px;">File Type Validation using PHP</h1>
	<hr>
	<div class="pakainfo row justify-content-center">
		<div class="col-sm-4">
			<?php
				if(isset($_SESSION['custom_err'])){
					echo "
						<div class='alert alert-danger text-center'>
							".$_SESSION['custom_err']."
						</div>
					";
 
					unset($_SESSION['custom_err']);
				}
 
				if(isset($_SESSION['success'])){
					echo "
						<div class='pakainfo alert alert-success text-center'>
							".$_SESSION['success']."
						</div>
					";
 
					unset($_SESSION['success']);
				}
 
			?>
			<div class="pakainfo card">
				<div class="card-body">
					<form method="POST" action="authorize.php" enctype="multipart/form-data">
					    <input type="file" class="form-control-file" name="file" required><br>
					    <button type="submit" class="btn btn-primary" name="authorize">Validate</button>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>

Making simple Validation

And then, we make simple HTML validation if simple HTML form is submitted to check data and input for the Like as a file/mime type of the PHP serever side uploaded file.

MAke a new file, name it as Serever side Like as authorize.php and copy and paste the source codes below.

<?php
	session_start();
 //pakainfo example
	if(isset($_POST['authorize'])){
		//free type pakainfo.com
		$permit = array('jpg', 'png', 'jpeg');
 
		$file = $_FILES['file']['name'];
		$ext = pathinfo($file, PATHINFO_EXTENSION);
 

		if(in_array($ext, $permit)){

			$_SESSION['success'] = 'Your File type permit';
		}
		else{

			$_SESSION['custom_err'] = 'Your File type not permit';
		}
	}
	else{
		$_SESSION['custom_err'] = 'Please Upload a file to authorize first';
	}
 
	header('location: index.php');
 
?>

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is How to create PHP based email form with file attachment And how it works.I would Like to have FeedBack From My Blog(pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(pakainfo.com) Are Most Always Welcome.

PHP Simple Image Upload and Display Source Code 0

PHP Simple Image Upload and Display Source Code

PHP Simple Image Upload and Display Source Code

In this Post We Will Explain About is PHP Simple Image Upload and Display Source Code With Example and Demo.Welcome on pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to PHP code for image upload and display Example

In this post we will show you Best way to implement How to Upload Files on Server in PHP, hear for ,
with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

In this post we will make a HMTL to Simple Image Upload using script of the PHP. PHP is a web based server-side PHP scripting language designed mainly primarily for ss side web development. this is a learn and consistent directory way to access mysql databases. This stand developers can script write portable source code more easier. It is best used by a newly freshar coders for its any user or developers user friendly environment. therefor Let’s do the source coding.

making the database dbconection

first of all the Open your mysql any kind of text simple editor( Like as a notepadd++, etc..). and Then just simple copy and paste the source code below after that name it dbcon.php.

<?php
	$dbcon = new mysqli('hostname', 'root', 'password', 'db_pic_name');
 
	if(!$dbcon){
		die("Error!: sorry Cannot dbconect to the database!");
	}
?>

Making The Interface

This is where I will make a simple form for our application. To make the HTML forms simply source code copy and write it into you text notepad editor, and then save data it as shown below source code.

index.php

<!DOCTYPE html>
<html lang="en">
	<head>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
		<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
	</head>
<body>
	<nav class="navbar navbar-default">
		<div class="container-fluid">
			<a class="navbar-brand" href="https://pakainfo.com">pakainfo.com</a>
	</div>
	</nav>
	<div class="col-sm-3"></div>
	<div class="col-sm-6 well">
		<h3 class="text-primary">Simple PHP - Simple Image Upload - pakainfo</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<div class="col-sm-2"></div>
		<div>
			<form method="POST" action="live_save_upload.php" enctype="multipart/form-data">
				<label>Name:</label>
				<input type="text" name="name"/>
				<div style="float:right;">
					<div id = "picture_prev_display" style = "width:150px; height :150px; border:1px solid #000;">
						<center id = "myimg">[Photo]</center>
					</div>
					<input type = "file" id = "mypicImg" name = "mypicImg" />
				</div>	
				<div style="clear:both;"></div>
				<br/>
				<center><button class="btn btn-primary" name="submit"><span class="glyphicon glyphicon-save"></span> Save</button></center>
			</form>
		</div>
		<br />
		<div class="col-sm-12">
			<table class="pakainfo table table-bordered exlive">
				<thead>
					<tr>
						<th>User Name</th>
						<th>Photo</th>
					</tr>
				</thead>
				<tbody>
					<?php 
						require 'dbcon.php';
						$squry = $dbcon->query("SELECT * FROM `students`") or die(mysqli_errno());
						while($retrive = $squry->retrive_array()){
 
 
					?>
					<tr>
						<td><?php echo $retrive['name']?></td>
						<td><center><img src="<?php echo "upload/".$retrive['mypicImg']?>" width="100px" height="100px"></center></td>
					</tr>
					<?php
						}
					?>
				</tbody>
			</table>
		</div>
	</div>
</body>
<script src="pakainfo/js/jquery-3.2.1.min.js"></script>
<script type = "text/javascript">
	$(document).ready(function(){
		$pic = $('<img id = "image" width = "100%" height = "100%"/>');
		$myimg = $('<center id = "myimg">[Photo]</center>');
		$("#mypicImg").change(function(){
			$("#myimg").remove();
			var files = !!this.files ? this.files : [];
			if(!files.length || !window.FileReader){
				$("#image").remove();
				$myimg.appendTo("#picture_prev_display");
			}
			if(/^image/.test(files[0].type)){
				var dreadr = new FileReader();
				dreadr.readAsDataURL(files[0]);
				dreadr.onloadend = function(){
					$pic.appendTo("#picture_prev_display");
					$("#image").attr("src", this.result);
				}
			}
		});
	});
</script>
</html>

Creating the Main Function

This source code data contains the specific source code for the upload. This will data process the upload image file that have been upload then will save it to a designated folder. To do that Copy and paste these source code block of source codes inside the main Text editor Like as notepad++ and call it as live_save_upload.php.

<?php
	require_once 'dbcon.php';
 
	if(ISSET($_POST['submit'])){
 
		if($_FILES['mypicImg']['name'] != "" && $_POST['name'] != ""){
			$name = $_POST['name'];
			$pic_name = $_FILES['mypicImg']['name'];
			$pic_temp = $_FILES['mypicImg']['tmp_name'];
			$pic_extention = explode('.', $pic_name);
			$image = time().".".end($pic_extention);
			move_uploaded_file($pic_temp, "upload/".$image);
			$dbcon->query("INSERT INTO `students` VALUES('', '$name', '$image')") or die(mysql_errno());
			header('location:index.php');
		}
	}
?>

so you have it I successfully make a PHP source code example Simple Image Upload using HTML and PHP. I hope that this simple Post help you to what you are looking for. For more many example updates and post and services just kindly all the example and tags visit this site. Good Luck Enjoy Coding!!!

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is PHP code for image upload and display And how it works.I would Like to have FeedBack From My Blog(pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(pakainfo.com) Are Most Always Welcome.

Simple PHP Create Custom Captcha Generator 0

Simple PHP Create Custom Captcha Generator

Simple PHP Create Custom Captcha Generator

Today, We want to share with you Simple PHP Create Custom Captcha Generator.
In this post we will show you Captcha Code in PHP, hear for PHP – Simple Captcha Generator we will give you demo and example for implement.
In this post, we will learn about Create CAPTCHA Script in PHP with an example.

Creating The Interface

This(simple PHP CAPTCHA) is where we will make a simple HTML form for simple web application and this file Main HTML interface view name as a index.php file

<!DOCTYPE html>
<?php session_start()?>
<html lang="en">
	<head>
	<title>how to add captcha in php registration form</title>
		<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="pakainfo/css/bootstrap.css"/>
	</head>
<body>
	<nav class="pakainfo navbar navbar-default">
		<div class="pakainfo container-fluid">
			<a class="navbar-brand" href="https://pakainfo.com">pakainfo.com</a>
</a>		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-success">Create PHP - Simple Captcha Generator</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<form action="" method="POST">
			<img src="do_custom_captcha.php" />
			<hr />
			<hr />
			<input type="text" name="captcha" />
			<?php
				if(ISSET($_POST['verify'])){
					if(!empty($_POST['captcha'])){
						if($_SESSION['captcha'] == $_POST['captcha']){
							echo "<label class='text-success'>captcha Validated</label>";
						}else{
							echo "<label class='text-danger'>captcha Invalid captcha!</label>";
						}
					}else{
						echo "<label class='text-warning'>Please fill up the All required field!</label>";
					}
				}
			?>
			<hr /><hr />
			<button name="verify" class="btn btn-success">Good Verify</button>
 
		</form>
	</div>
</body>
</html>

Makeing the Main Function

This source codes inside the any text editor Like as a Notepad++ or any editor and simple copy and paste this scripts save it as do_custom_captcha.php file

<?php
//Create CAPTCHA Script in PHP
	session_start();
 
	$fun_random = rand(1, 9).rand(1, 9).rand(1, 9);
 
	$_SESSION['captcha'] = $fun_random;
 
	$live_captcha = imagecreatefromjpeg("upload/live_captcha.jpg");
	$all_color = imagecolorallocate($live_captcha, 0, 0, 0);
	$my_font = 'code.otf'; 
	imagettftext($live_captcha, 20, 0, rand(30, 200), rand(20, 70), $all_color, $my_font, $fun_random );
	imagepng($live_captcha);
	imagedestroy($live_captcha);
?>

There you have it we good and very easy way to successfully source code made a Simple PHP Captcha Generator. We hope that this simple Post help and copy paste to run this source code you to what you are looking for.

We hope you get an idea about Create CAPTCHA Script in PHP
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Autocomplete Textbox using jQuery, PHP and MySQLi 0

Autocomplete Textbox using jQuery, PHP and MySQLi

Autocomplete Textbox using jQuery, PHP and MySQLi

Today, We want to share with you Autocomplete Textbox using jQuery, PHP and MySQLi.
In this post we will show you php autocomplete textbox from database, hear for jQuery Autocomplete Tutorial with PHP and MySQLi we will give you demo and example for implement.
In this post, we will learn about jquery autocomplete multiple fields using jquery ajax php and MySQLi with an example.

Making the database connection

simple this source code copy and paste your database connection file such as db_connect.php file.

<?php
	$conn = new mysqli('localhost', 'root', 'YOUR_PASSWORD', 'YOUR_DB_NAME');
 
	if(!$conn){
		die("Error: sorry, Can't connect to database");
	}
?>

Making The Interface

this is source code for main HTML interface File name as a index.php.

<!DOCTYPE html>
<html lang="en">
	<head>
	<title>Autocomplete Textbox using jQuery, PHP and MySQLi - pakainfo.com</title>
<link rel="stylesheet" type="text/css" href="src/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="src/jquery-ui.css"/>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
	</head>
<body>
	<nav class="gst navbar navbar-default">
		<div class="container-fluid gst">
			<a class="navbar-brand" href="https://pakainfo.com">Pakainfo.com</a>
</a>		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-suceess">Autocomplete Textbox using jQuery, PHP and MySQLi</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<div class="col-md-2"></div>
		<div class="col-md-8">
			<div class="form-group">
				<form action="" method="POST">
					<label>Find Item here...</label>
					<div class="auto-widget">
						<input class="form-control" id="find_item" type="text" name="item"/>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/jquery-ui.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#find_item").autocomplete({
			source: 'find_item.php',
			minLength: 0,
		});
	});
</script>
</html>

Making the Main Function

It’s server side source code for file name as a find_item.php

<?php
	require_once 'db_connect.php';
 
	$find_item = $_GET['term'];
 
	$query = $conn->query("SELECT * FROM `item` WHERE `item` LIKE '%$find_item%' ORDER BY `item` ASC") or die(mysqli_connect_errno());
 
	$item_lst = array();
	$data_row = $query->num_rows;
 
	if($data_row > 0){
		while($fetch = $query->fetch_assoc()){
			$data['value'] = $fetch['item']; 
			array_push($item_lst, $data);
		}
	}
 
	echo json_encode($item_lst);
?>

We hope you get an idea about Autocomplete Textbox using jQuery, PHP and MySQLi
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Simple PHP jQuery Ajax Insert Update Delete using MySQLi 0

Simple PHP jQuery Ajax Insert Update Delete using MySQLi

Simple PHP jQuery Ajax Insert Update Delete using MySQLi

Today, We want to share with you Simple PHP jQuery Ajax Insert Update Delete using MySQLi.
In this post we will show you PHP – Simple CRUD With Ajax/MySQLi, hear for live table add edit delete using ajax jquery in php mysql we will give you demo and example for implement.
In this post, we will learn about Ajax Add & Delete MySQL records using jQuery & PHP with an example.

Making the database connection

first of all simple database connection using PHP simple copy and paste this source code db_connect.php

<?php
	$db_connect = new mysqli('localhost', 'root', 'YOUR_PASSWORD', 'pakainfo_db');
 
	if(!$db_connect){
		die("Error: Sorry Cannot connect to the your database");
	}
?>

Making The Interface

main file All the HTML and PHP Form Interface Like name as a index.php.

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
		<link rel="stylesheet" type="text/css" href="pakainfo/css/bootstrap.css"/>
	</head>
<body>
	<nav class="pakainfo navbar navbar-default">
		<div class="pakainfo container-fluid gst">
			<a class="navbar-brand" href="https://pakainfo.com">pakainfo.com</a>
</a>		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-success">PHP - Simple CRUD With Ajax/MySQLi</h3>
		<hr style="border-top:1px dotted #ccc;"/>
		<form method="POST">
			<div class="gst form-inline">
				<label>Client Name</label>
				<input type="text" id="clientfname" class="pakainfo form-control"/>
				<label>Lastname</label>
				<input type="text" id="clientlname" class="pakainfo form-control"/>
			</div>
			<br />
			<div class="gst form-inline">
				<label>location</label>
				<input type="text" id="location" class="pakainfo form-control"/>
			</div>
			<br />
			<center><button type="button" id="save" class="btn btn-success"><span class="paka glyphicon glyphicon-save"></span> Save</button><button type="button" id="update" class="paka btn btn-warning"><span class="paka glyphicon glyphicon-edit"></span> Update</button></center>
		</form>
		<br />
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>Client Name</th>
					<th>Location</th>
					<th>Action</th>
				</tr>
			</thead>
			<tbody id="data"></tbody>
		</table>
	</div>
</body>
<script src="pakainfo/js/jquery-3.2.1.min.js"></script>
<script src="pakainfo/js/script.js"></script>
</html>

save_query.php

This source code will save all the record the data input form to the mysql database PHP server side.

<?php
	require_once 'db_connect.php';
 
	$clientfname = $_POST['clientfname'];
	$clientlname = $_POST['clientlname'];
	$location = $_POST['location'];
 
	$db_connect->query("INSERT INTO `client_mst` VALUES('', '$clientfname', '$clientlname', '$location')");
?>

data_query.php

This source code will client_row and displaying the data from the get all the record in database.

<?php
	require_once 'db_connect.php';
	if(ISSET($_POST['res'])){
		$query = $db_connect->query("SELECT * FROM `client_mst`");
		while($client_row = $query->fetch_array()){
			echo
				"
					<tr>
						<td>".$client_row['clientfname']." ".$client_row['clientlname']."</td>
						<td>".$client_row['location']."</td>
						<td><center><button class='btn btn-warning edit' name='".$client_row['client_id']."'><span class='glyphicon glyphicon-edit'></span> Edit</button> | <button class='btn btn-danger delete' name='".$client_row['client_id']."'><span class='glyphicon glyphicon-trash'></span> Delete</button></center></td>
					</tr>
				";
 
		}
	}
 
?> 

delete_query,php

This source code will delete particuler record the data from the sql database.

<?php
	require_once 'db_connect.php';
 
	$id = $_POST['id'];
 
	$db_connect->query("DELETE FROM `client_mst` WHERE `client_id` = '$id'");
?>

client_edit.php

first of all each person edit this record via users id to get and select query using PHP in MySQLi

<?php
	require_once 'db_connect.php';
 
	if(ISSET($_POST['id'])){
		$id = $_POST['id'];
 
		$query = $db_connect->query("SELECT * FROM `client_mst` WHERE `client_id` ='$id'");
		$client_row = $query->fetch_array();
 
		$array = array(
			'client_id' => $client_row['client_id'],
			'clientfname' => $client_row['clientfname'],
			'clientlname' => $client_row['clientlname'],
			'location' => $client_row['location']
		);
 
		echo json_encode($array);
	}
?>

client_update.php

Server side source code for All the Data update queryin Mysql using PHP

<?php
	require_once 'db_connect.php';
 
	if(ISSET($_POST['id'])){
		$id = $_POST['id'];
		$clientfname = $_POST['clientfname'];
		$clientlname = $_POST['clientlname'];
		$location = $_POST['location'];
 
		$db_connect->query("UPDATE `client_mst` set `clientfname` = '$clientfname', `clientlname` = '$clientlname', `location` = '$location' WHERE `client_id` = '$id'");
	}
 
?>

Making The Ajax Funcition

Save the Custom Javscript File Like name as a script.js inside the all the libs in js folder.

$(document).ready(function(){
	var client_id;
 
	RetriveClientData();
 
	$('#update').hide();
 
	$('#save').on('click', function(){
		if($('#clientfname').val() == "" || $('#clientlname').val() == "" || $('#location').val() == ""){
			alert("Hello World");
		}else{
			var clientfname = $('#clientfname').val();
			var clientlname = $('#clientlname').val();
			var location = $('#location').val();
 
			$.ajax({
				url: 'save_query.php',
				type: 'POST',
				data: {
					clientfname: clientfname,
					clientlname: clientlname,
					location: location
				},
				success: function(data){
					 $('#clientfname').val('');
					 $('#clientlname').val('');
					 $('#location').val('');
					 RetriveClientData();
				}
			});
		}
 
	});
 
	function RetriveClientData(){
		$.ajax({
			url: 'data_query.php',
			type: 'POST',
			data: {
				res: 1
			},
			success: function(response){
				$('#data').html(response);
			}
		})
	}
 
	$(document).on('click', '.delete', function(){
		var id = $(this).attr('name');
 
		$.ajax({
			url: 'delete_query.php',
			type: 'POST',
			data: {
				id: id
			},
			success: function(data){
				RetriveClientData();
				$('#update').hide();
				$('#save').show();	
				$('#clientfname').val('');
				$('#clientlname').val('');
				$('#location').val('');
			}
		});
	})
 
	$(document).on('click', '.edit', function(){
		var id = $(this).attr('name');
 
		$.ajax({
			url: 'client_edit.php',
			type: 'POST',
			data: {
				id: id
			},
			success: function(response){
				var fetchArr = jQuery.parseJSON(response);
 
				client_id = fetchArr.client_id;
 
				$('#clientfname').val(fetchArr.clientfname);
				$('#clientlname').val(fetchArr.clientlname);
				$('#location').val(fetchArr.location);
 
				$('#update').show();
				$('#save').hide();	
			}
		})
	});
 
	$('#update').on('click', function(){
		var clientfname = $('#clientfname').val();
		var clientlname = $('#clientlname').val();
		var location = $('#location').val();
 
 
		$.ajax({
			url: 'client_update.php',
			type: 'POST',
			data: {
				id: client_id,
				clientfname: clientfname,
				clientlname: clientlname,
				location: location
			},
			success: function(){
				RetriveClientData();
				$('#clientfname').val('');
				$('#clientlname').val('');
				$('#location').val('');
 
				alert("Client Details Successfully Updated!");
 
				$('#update').hide();
				$('#save').show();	
 
				client_id = "";
			}
		});
	});
});

There you have step by step done it we successfully made a Simple webapplication Like as a insert update and delete CRUD With Ajax/MySQLi using PHP Example.

We hope you get an idea about PHP – Simple CRUD With Ajax/MySQLi
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.