Learnt PHP at last

Learning PHP when it was presented as a part of MCA syllabus was a tough ask for me , but asking to do a simple web page using PHP and HTML with just in a few hours of time is further more difficult .

This was the case when my friend asked me to do the same (a simple Registration page ) for the Gateways 2008 ( Inter- college IT fest conducted by PG Dept. of Computer Science , Christ College – Bangalore ) and that too in a short span of time but to an extend was successful in understanding how it works and did it .

This was done solely from the Code lifted from one of My lecturer ( Mr. Ashok immanuel ) and some changes made by us for the same.This involved not using MySql but just Files

The Code for the same is done using 3 files as stated below.

1. Reg.html – a html file for the interface

2. a1.php – This files contains some of the PHP code to write in to the mail and send a mail

$flag=0;
$college_name = 0;
$college_address = 0;
$contact_person = 0;
$contact_email = 0;
$contact_phone = 0;
$nl=",";
$n2=”\n”;
if($_POST['collegename']==" ")
return false;
else
$flag=1;
$college_name=$_POST['collegename'];
$college_address=$_POST['collegeaddress'];
$contact_person=$_POST['contactperson'];
$contact_email=$_POST['contactemail'];
$contact_phone=$_POST['contactphone'];
$str=$n2. $college_name .$nl. $college_address .$nl. $contact_person .$nl. $contact_email .$nl. $contact_phone . “     ” ;
$fp = fopen("data.txt", "+");
fwrite($fp,$str);
fclose($fp);
$to="gateways@mca.christuniversity.in";
$subject="Registration of " . $college_name ;
$message = "College Name : ". $college_name ."
 College Address : ". $college_address ."
 Contact Person : ". $contact_person ."
 Contact Email : ". $contact_email ."
 Contact Phone : " . $contact_phone . "     " ;
$headers = "From: ". $contact_email;
$headers .= "\r\nContent-Type: text/html;charset=iso-8859-1\r\nContent-Transfer-Encoding: 7bit";
$msg=" ";
if(@mail( $to, $subject, $message, $headers ))
{

$msg = " Registration Request Sent Successfully";
echo $msg;                           
}
$_POST['collegename']=" ";
$_POST['collegeaddress']="";
$_POST['contactperson']="";
$_POST['contactemail']="";
$_POST['contactphone']="";
?>

3. data.txt – a text files to store all the registration details

Thats it my work was done with in a day.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

One Response

  1. Sam Katoozi June 22, 2011 Reply

Leave a Reply


x

Interesting BlogPosts to read

Download - Pokemon Go for for Windows 10 (Third Party app)
Pokemon Go is one of the popular AR games for android and iOS devices and now , the game is made ava...
Open Wordpad from command line in Windows
You can use the command "Write" from command line in Windows to open the WordPad application.D:\>...
Swift Developers June User Group meeting in Bangalore
SwiftBLR (Swift Bengaluru) is hosting an user group meet on June 11 , 2016 from 2.30 PM to 6.00 PM a...