php

Example AJAX with JSON, jQuery, PHP and MySQL

example ajax jquery mysql

Today I will show you a simple example in which I use AJAX with JSON, jQuery, PHP and MySQL. It's a product list when you select one, it makes an ajax request to retrieve the data from a database and display them on screen. See live example clicking here To create this example we will need: database, index.php, ...

Read More... "Example AJAX with JSON, jQuery, PHP and MySQL"

Example code Captcha with PHP and GD Library

captcha

In this tutorial I'll teach you how to make a captcha with php using GD Graphics Library. See live example clicking here To create our captcha we will need: captcha.php index.php and arial.ttf (font) Step 1 - captcha.php <?php session_start(); header("Content-type: image/jpeg"); $code = generateCode(); $fonts = str_split($code); $img = imagecreatetruecolor(300,120); $color=imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255)); imagefill($img,0,0,$color); $fontColor=imagecolorallocate($img,255,255,255); $font ="arial.ttf"; for($i=0;$i<sizeof($fonts);$i++){ imagefttext($img,30,rand(-20,15),12*$i*2+35,45,$fontColor,$font,$fonts[$i]); } imagejpeg($img); imagedestroy($img); $_SESSION['captcha']=$code; function generateCode(){ $cod1 = ""; $i = 0; while($i<2){ $cod1.=chr(rand(48,57));; $cod1.=chr(rand(65,90));; $cod1.=chr(rand(97,122));; $i++; } return $cod1; } ?> In this file we create an ...

Read More... "Example code Captcha with PHP and GD Library"

Chessboard with PHP, HTML and CSS

chessborad php

In this small code, I'll teach you how to create a chessboard in a simple way with PHP, HTML and CSS. Just have to make a table with a loop in php and apply styles. See live example clicking here. Code index.php (without form) <html> <head> <title>Chessboard with PHP, HTML and CSS - Ajax101.com</title> <style> table{ border: solid 1px; } table tr td{ width: 50px; height: 50px; } .black ...

Read More... "Chessboard with PHP, HTML and CSS"