Category Archives: php

Sending E-Mail with PHP

May 5, 2013   General, How To:, php   Author: 
Sending E-Mail with PHP
PHP  is a  powerful tool to develop a dynamic site. E-mail is also included in the PHP. Codes to sending e-mail is not a complex or tough thing. Here the simple syntax for the email will be explained. Make use of it. This is too  simple to understand. The function for the  E-mail is mail().  You can assign different variables instead of $to,$body,$subject .  Just test  it and create a new things from this example. [code type=php] <?php $to = "spk063@gmail.com"; $subject = "Your email has been sent!"; $body = "This is a test"; if(mail($to,$subject,$body)) { echo "<b>

How To: Insert Data into Database using Check Box in PHP

July 23, 2012   php   Author: 
Here i am going to insert data into mysql database using checkbox in php script. In radio button, only one option have to be selected under many option and all that options name will be same. In Checkbox also same as the radio button's properties, but the difference between them is many options can be selected in checkbox. So  that name of check box is to be given in array ( game[])   Create database  "data" and table "tb". [code type=sql] CREATE TABLE `data`.`tb` (`id` VARCHAR( 25 ) NOT NULL , `choice` VARCHAR( 5 ) NOT NULL) ENGINE = INNODB; [/code]  

Simple PHP Code To Upload Files

June 20, 2012   php   Author: 
In this tutorial i have given the simple php code to upload files into server directory. To upload file <form> should contain  enctype="multipart/form-data", input type is file. $_FILES['photo']['name'] - This will give the name of the uploaded file $_FILES['photo']['tmp_name'] - Temporary name will be created for file to be uplaoded.  $_FILES["file"]["type"] - Returns file type i.e., format of the file. If the file is image (pic.jpg), then this will return .jpg $_FILES["file"]["size"] - Returns size of the file, which we have uploaded. $_FILES["file"]["error"] - Erro

How To: Remove Space from String in PHP

June 20, 2012   php   Author: 
Spaces in a string will makes problem, when that string is to used as username or password. There are many php functions available to remove the space from string. Here we are going to see removing spaces from strings in php using php functions. Some of them are trim() rtrim() str_replace() Need of removing space from string In user registration, username and password shouldn't  have spaces. Allowing empty sting make the security breach in our website. User may give space in any field, then it will be taken as a value and creates error. To avoid this we are removing spaces

Php Code to Get Current Webpage URL

June 15, 2012   php   Author: 
PHP having the super global variables $_SERVER to get currently using page URL URL - http://www.tobbynews.com/page/2.php $_SERVER['PHP_SELF'] PHP_SELF will return the currently working webpage with their directory path ( /page/2.php ) $_SERVER['SCRIPT_NAME'] SCRIPT_NAME is introduced in CGI, and it also returns the currently working webpage ( /page/2.php ) $_SERVER['HTTP_HOST'] HTTP_HOST is a client controlled value and returns domain name (http://www.tobbynews.com) $_SERVER['SERVER_NAME'] SERVER_NAME is server controlled value (http://www.tobbynews.com) $_SERVER['REQUES

How To: Insert Data into MySQL Database Using Drop Down Box in PHP

June 14, 2012   php   Author: 
Using PHP and Mysql, we can store data obtained from drop down box into mysql table. The biggest reason for using drop down box is it allows user to only one option only i.e., limited options. A question may arise radio button also gives this functionality of selecting of only one option, but what is special in drop down box?  Reason is more options can be given with low area (space in webpage) and can easily fetch by typing first letter of the option. Read also: How To: Insert Multiple Values Using Dropdown List Box in PHP Create database  "data" and table "tb". [code type=sql]

Submitting Form without Using Submit button in JavaScript

June 2, 2012   Javascript, php   Author: 
Forms in website are used to submit values to the server or to give query or to request some thing. Every form will have  a submit button, which is clicked after finishing filling up of form values. After clicked the submit button only form values are get processed. In some instance there many be situation to submit form values without using buttons. This problem can be achieved by java script. READ ALSO: Submit Form Without Submit Button, When Drop-down List box is Selected Submit Form Without Submit Button, When Radio Button is Clicked document.forms["FormName"].submit();  is

PHP Code to Get IP address of Website Visitor

June 2, 2012   php   Author: 
Knowledge about where the website is visited is important and how many visits are made by a same visitor. This can possible only by tracking IP address of the visitor, every internet user will have an unique IP address by this we can calculate from where our website is being visited. Along with tracking of IP address, recording date and time also important. Because IP address for a user at day1 will be assigned to some other user at day2 or even in day1 itself. Here is the PHP code to track the IP address and storing the IP address with its associated in datebase. Tracking IP address

What is the difference between Apache and WAMP Server

May 26, 2012   php   Author: 
Is it Need to install Apache or WAMP server in computer to use PHP? Yes, because PHP is server side scripting language and it runs only in server. By installing apache server, our client OS ( client OS means windows xp/vista/7) computer will acts as both server and client. Here client means browser and server means web server, request from browser will fetch data from web server using http protocol.   Apache Server Apache is a web server, which is used to serve the web pages. Apache is a open source software, it runs in almost all operating system like Mac OS X, UNIX, LINUX, Win