Skip to main content

Posts

Showing posts from May, 2017

Database Connection in PHP

Database Connection in PHP Syntax of Database Connection:- mysql_connect("host","username","password"); mysql_select_db("database_name");  Index.php <?php include('header.php'); ?> <html> <head> <title>hello</title> <style> .error{color:red}   body{background:#333;color:white;}  a{color:inherit;text-decoration:none;}  a:hover{color:inherit;text-decoration:underline; font-size:20px; transition:0.8s;} .error{color:white;} .div{width:1000px;margin:0px auto; height:500px; background:orangered;text-align:center;    padding-top:20px; } #frm{width:300px; height:30px; outline:none; border:0px;text-indent:1in;background:#333;} #button{background:#333;color:white;outline:none; border:0px;border-radius:10px; height:30px;   width:70px;  } </style> </head> <body>  <?php   if(!empty($_POST[submit])) { if(empty($_POST[name])) { $err...

File Upload in PHP

File upload in PHP There are two best ways for Upload file in PHP 1.External PHP File Make Index File <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> upload_file.php <?php           if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "application/msword") || ($_FILES["file"]["type"] == "application/pdf") ||...

PHP SUPER GLOBALS

Superglobals are variable that are automatically available throughout all program code,in all scopes. These variables require no declaration they can simply be accessed. Super global variables provide: Useful information about the environment Allow access to HTML form  variables or parimeters Access to cookies stored on a client Keeping track of sessions and file uploads   They are as follows: $_GET  - $_GET is used for data passed using the HTTP GET method,which includes variables passed as part of the URL. For Example: www.designevlop.blogspot.com/index.php?book=PHP&cat=linux                                                                                                             ...