Copying Files in PHP January 6, 2013 Copying Files in PHP: The copy() function is very simple: It needs to know the original filename and a new filename, and that’s all there… Continue Reading
Read Data from File with Proper New Line January 6, 2013 Read Data from File with proper New Line : That’s definitely the string written to the file, but what happened to that line break?… Continue Reading
Read Data from File January 6, 2013 Read Data from File: <?php$filename = “e:/readdata.txt”;$myfile = fopen($filename, “r”) or die(“Unable to open file”);$showfile = fread($myfile, filesize($filename));$showfile = “<br>$showfile<br/>”;$msg = “The file contents… Continue Reading
Append a File in PHP January 6, 2013 Append a File in PHP:<?php$filename = “e:/appendfile.txt”;$writetext = “My First filenHi world I am ASHISH PRAJAPATI”;$writefile = fopen($filename,”a+”) or die(“unable to create file”);fwrite($writefile, $writetext)… Continue Reading
Create a New File in PHP January 5, 2013 Create a New File in PHP: <?php$filename = “e:/ashu.txt”;if(file_exists($filename)){$msg = “file already exists”;}else{$newfile = fopen($filename, “w+”) or die(“Unable to create file”);fclose($newfile);$msg = “<p>file created</p>”;}?><html><head><title>Creating… Continue Reading
Working With fopen and fclose in PHP January 4, 2013 Working with fopen() and fclose() Before you jump headfirst into working with files, you need to learn a bit about the fopen() function, which… Continue Reading
Display Directory Contents in PHP January 4, 2013 Example:<?php$dir = opendir(“c:/”);while($i = readdir($dir)){if(($i != “.”) && ($i != “..”)){echo “<li>$i<br>”;}} ?> save as dir.php and save to the web server. Continue Reading
Sending Emails in PHP January 4, 2013 Using an SMTP Server: SMTP is an acronym for Simple Mail Transfer Protocol, and an SMTP server is a machine that transports mail, just… Continue Reading
Getting Variables from Forms in PHP January 4, 2013 HTML forms contain at least the following elements: 1. A method 2. An action 3. A submit button In your HTML code, the first… Continue Reading
Logical Operators January 4, 2013 Logical Operators allow your script to determine the status of conditions (such as the comparisons in the preceding section). In the context of if…else… Continue Reading