Tuesday, 25 August 2015

Validations using PHP code

For Applying Validations using PHP. we have to first create a webpage using HTML for example here login page validation page is created in HTML.

<html>
<head>
<title>Login form</title>
</head>
<body bgcolor="yellow">
<form id="form1" method="POST" action="n.php">
<center><h1 ><font color="Blue" size="30px">Login Form</font></h1>

Enter Username: <input type="text" name="username" size="28" /> <br />
Enter Password: &nbsp;<input type="password" name="password" size="28" /> <br />


<input type="button" name="submit" value="submit" />
<input type="button" name="cancel" value="Cancel" />

</center>
</form>
</body>
</html>

For Learning How to give validations in the PHP.
Visit Website: PHP Training

PHP Project Training in Vadodara

Learn PHP Project from professional trainer. PHP Project Training course includes the topics from report writing to testing of your project.
Course Content : 
1. Project Introduction and Report Writing
2. PHP Programming
3. HTML
4. CSS
5. JavaScript
6. MySQL
7. DataBase Connectivity
8. Session Management
9. Testing

For More Details visit : http://www.vataliyatuitionclasses.com

Monday, 7 July 2014

How to upload a file using PHP ?

For uploading a file in PHP + MySQL, we have to use datatype as varchar(250) to store the filename and it's path.

Before uploading any photo or doc we must have to make our form tag as enctype. And inside the phpcode we must have to check weather the file is already exists in that location or not.

For Example. Table of Database is given
tblimagedemo
Data Type            Column Name 
id                           int                             PK  Auto_Increment  
photo                    varchar(250)

On Webpage file upload control is given in below image to choose file with button submit.


For that write HTML code.

<form method="post" name="pform" id="pform" action="" enctype="multipart/form-data">
<table>
<tr>
<td>Image</td>
<td>
<input type="file" value="" name="file" id="file"/>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="submit" name="btnsubmit"/>
<input type="button" value="reset" name="btnreset"/>
</td>
</tr>
</table>
</form>


Write PHP code in head or body section.
<?php

if(isset($_POST['btnsubmit']))
{
if($_FILES['file']['error']>0)
   {
         echo"Error in uploading";
   }
else
   {
       echo"upload:".$_FILES['file']['name']."<br>";
        $i="image/".$_FILES['file']['name'];

         if(file_exists("image/".$_FILES['file']['name']))
          {
                       echo $_FILES['file']['name']."File is already  Exists";
          }
          else
          {
                   move_uploaded_file($_FILES['file']['tmp_name'],"image/".$_FILES['file']['name']);
                  echo "File is uploaded successfully";
          }
    }
if(empty($i))
{
echo "Upload your image";
}
else
{
$sql = "INSERT INTO `superstore`.`tblimagedemo` (`id`, `photo`) VALUES (NULL, '$i')";

                 if(mysqli_query($con,$sql))
                {
                      echo"Record inserted";
                 }
                else
                {
                        echo"error";
                 }
}
}

Learn PHP Project with MySQL 
visit website : Final Year Project Training in Vadodara for student

Saturday, 5 April 2014

Date Datatype in PHP with Different Date Format.

Date in PHP with Example code.

Date Datatype's syntax is the 

date(format in string, time stamp);

Default format which the developer wants is dd/mm/yyyy we can do it by following code.

 date("d/m/Y");

This code will print the current date with 05/04/2014

Formats a time and date according to the format string provided in the first parameter. If the second parameter is not specified, the current time and date is used.As shown in the above example.

 date("m/d/Y");

This code will print the current date with 04/05/2014

The mktime() function returns the timestamp for the date and we can store the output of the function mktime() to any variable in php for printing suitable date.


Syntax of mktime() is given below

mktime(hour,minute,second,month,day,year,is_dst)

We can change the format of the date by mktime function.By providing the time stamp as a second argument in the date function.
if we want to print the date after 10 days then we can use below formatting.with the help of mktime and date.
hour=0
minite=0
second=0
month = m means current month April (4)
day = d+10 means 10 days will be added to the current date and
year = Y means current year (2014)

$dateten = mktime(0,0,0,date("m"),date("d")+10,date("Y"));
echo "The date after 10 days is ".date("d/m/Y", $dateten);


output : The date after 10 days is 15/04/2014

Here in above example the $dateten variable will print the date after 10 days as output.

Date Format

D
Instead of current date 05 if we have to print name of the day then use above char D.It will print first three letters of the current day.

 date("D/m/Y");

This code will print the current date with SAT/04/2014

l (small l)
Instead of current date 05 if we have to print name of the day then use above char D.It will print name the current day.

 date("l/m/Y");

This code will print the current date with Saturday/04/2014


M
Instead of current Month 04 if we have to print name of the month then use above char F.It will print first three letters of the current month.
 date("d/M/Y");

This code will print the current date with 05/Apr/2014

F
Instead of current Month 04 if we have to print name of the month then use above char F.It will print name of the current month.

 date("d/F/Y");

This code will print the current date with 05/April/2014

y
If we have to print the Current year's last two digits then use y.Year with two digits; e.g., “14”.

date("d/m/y");

This code will print the current date with 05/04/14

PHP PRoject Training in Vadodara Gujarat.
Best PHP training provider in Vadodara.
Visit Website : PHP Training Center Gujarat

Friday, 21 February 2014

How To Update Your Record Using PHP code ???

Update Records Using PHP + MySQL 

          If Any One wants to update his/her profile then he/she must have to login for that.
And according to their username and password the profile management is done.

Here is the code for any programmer or developer who want's to manage users and admins from their website.
1. First of all he/she have to see all the records of the table 
2. then select any record to update
3. After updating the record he/she must have to see updated record with all other records.

Table Name of MySQL is tbladmin_reg
Have columns
1. id
2. fullname
3. userid
4. password
5. emailid
6. mobileno

Here is the full code for admin registration1. show details


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Show Registration Details </title>
<link rel="stylesheet" href="table.css" type="text/css">
<?php
include('dbconnection.php');
$sql="select * from tbladmin_reg";
$result=mysqli_query($con,$sql);
echo "<center>";
echo "<h1> SHOW REGISTRATION FORM </h1>";
echo "<table width='90%'>";
echo "<tr>";
echo "<th> ID NO. </th>";
echo "<th> FULL NAME </th>";
echo "<th> USER ID </th>";
echo "<th> PASSWORD </th>";
echo "<th> Email ID </th>";
echo "<th> MOBILE NO </th>";
echo "</tr>";

while($line=mysqli_fetch_assoc($result))
{
echo "<tr>";
echo "<td>";
echo $line['id'];
echo "</td>";
echo "<td>";
echo $line['fullname'];
echo "</td>";
echo "<td>";
echo $line['userid'];
echo "</td>";
echo "<td>";
echo $line['password'];
echo "</td>";

echo "<td>";
echo $line['emailid'];
echo "</td>";

echo "<td>";
echo $line['mobileno'];
echo "</td>";
$id=$line['id'];
echo "<td>";
echo "<a href=\"updatereg.php?id=$id\">Edit</a>";
echo "</td>";
echo "</tr>";
}
?>
</head>

<body>
</body>
</html>

2. 
And here is the code for updatereg.php file
updatereg.php

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Record</title>
</head>
<?php
$id=$_REQUEST['id'];
include('dbconnection.php');
$sql="select * from tbladmin_reg where `id`='$id'";
$result=mysqli_query($con,$sql) or die("Database table error");
echo "<center>";
echo "<h1> Update Record </h1>";
echo "<table width='90%'>";
echo "<tr><td>FullName</td><td>";
while($line=mysqli_fetch_assoc($result))
{
?>

<body>
<form id="form1" name="form1" method="post" action="" />
<input type="text" name="fullname" value="<?php echo $line['fullname']; ?>" />
<?php
echo "</td></tr><tr><td>UserID</td><td>";
?>
<input type="text" name="username" value="<?php echo $line['userid']; ?>" />

<?php
echo "</td></tr><tr><td>EmailID</td><td>";
?>
<input type="text" name="emailid" value="<?php echo $line['emailid']; ?>" />
<?php
echo "</td></tr><tr><td>Mobileno</td><td>";
?>
<input type="text" name="mobileno" value="<?php echo $line['mobileno']; ?>" />

<?php
echo "</td></tr><tr><td></td><td>";
?>

<?php
echo "</td></tr></table>";
}
?>
<input type="submit" name="submit" value="Submit" />
</form>
<?php
if(isset($_POST['submit']))
{
$id=$_REQUEST['id'];
$ui=$_POST['username'];
$fn=$_POST['fullname'];
$ei=$_POST['emailid'];
$mn=$_POST['mobileno'];

include('dbconnection.php');
$sql="update tbladmin_reg set `userid`='$ui',`fullname`='$fn',`emailid`='$ei',`mobileno`='$mn' where `id`='$id'";
$result=mysqli_query($con,$sql) or die("Database table error");
echo "Record Updated Successfully!!!";

}
?>   
</body>
</html>

Thursday, 17 October 2013

WordPress - The CMS

WordPress Definition 
                      WordPress is a Content Management System based on PHP and MySQL.WordPress is very popular CMS and it is easy to learn and use this CMS compare to any other CMS. It is an Open source Project made by community and there were thousands of developer around the world handle it.
                    
Features of WordPress 
                      1) WordPress Provides more than 2 thousands of Themes today and it's growing.With the help of theme we can change the look of the website with only one click.
                      2) It provides more than 27 thousands of Plugins for making different websites from others to give varieties of techniques and functions to the website.
                      3) There were plenty of websites available which are built with the help of this CMS. Today there were millions of websites are there which were made using WordPress.
                      4) Menu management is very easy and we can arrange any numbers of menu items into menu of our website using WordPress.
                      5) We have to just write our content the management will be done by automatically in the CMS.
                       6)Every day new plugins or update of older plugins is available to and it's most of them are for free.And that's the reason for people or developer around the world are using WordPress.
                       7) We can also get supported by active community members of the WordPress.org

                     

Learn CMS Training with PHP Project Training
Visit Website : CMS Training Institute

                   
                     

Tuesday, 24 September 2013

What is CMS or Content Management System ?

Introduction to CMS
                           CMS is Content Management System used to create Website. It is the Technology in the world of Web. CMS is very useful tool for creating User Friendly, Interactive, Innovative Websites. We can easily learn CMS and create websites within sort time. If you are programmer or not You can Easily create an eye catchy website with the help of Content Management System.
                           If you are creating a website that have to more than ten pages you have probably run into the problems associated with adding new pages, or groups of new pages into the website. It becomes difficult to add to the menu of every existing page. A Content Management System handles the Menu's, And navigational aids for you. CMS free you to concentrate on your writing for your website. 
                          Several Popular CMS in the world are :
                          1. Wordpress
                          2. Joomla
                          3. Drupal
                          4. Modx
                          5. TinyCMS , etc.

Advantages of CMS : 
                        1. CMS is very useful for creating article or webpage content and we can easily modify or delete the content of the webpage. 
                         2. The template of the website also managed well.Using only a single click we can change the layout or template of the whole website.
                         3. We can also add lots of addon or modules into the CMS which are already created by the group of contributors or professionals. 
                          4. Menu management is also there and we can position our menu to different location on the webpage.
                           

                           
                            
Learn PHP CMS visit website : Click Here