# Simple PHP Tutorial



## [xubz] (Nov 14, 2007)

Hey Guys! I wrote an Extremely Small Tutorial on PHP.

It teaches you the Basic Syntax AND a Mini-Project, A Contact Form that Emails.

This Tutorial is meant ONLY for Those who already know atleast C Programming language and can understand some basic Syntax. (knowing HTML will help a LOT too)

Software Requirements:
1. Notepad
2. A Webserver (either one running offline or online)

It Consists of 2 Files, contact.html and validate.php

*contact.html*

```
<form method="post" action="validate.php">
	<table>
		<tr>
			<td>Name</td>
			<td><input type="text" name="txtName" maxlength="25"></td>
		</tr>
		<tr>
			<td>Email</td>
			<td><input type="text" name="txtEmail"></td>
		</tr>
		<tr>
			<td colspan="2">Message</td>
		</tr>
		<tr>
			<td colspan="2"><textarea name="txtMessage" rows="6"></textarea></td>
		</tr>
		<tr>
			<td colspan="2" style="text-align: right;"><input type="submit" name="btnSubmit" value="Submit"></td>
		</tr>
	</table>
</form>
```

This is Basic HTML and anyone can understand, It has a Form that submits to validate.php


Get the Contents of *validate.php* HERE

The Mini-Tutorial is embedded in the Comment-Lines, You can just read that.

Do Mind that the email functionality only works when the SMTP server is running OR the Host supports mail() function.

See the Functioning Example here (it doesn't email me, don't worry).


I think the basics should help your write your own mini scripts 
My next article will be about Database (mysql) Connectivity (maybe in december)

Post any Doubts/Queries Here

--Subbu


----------



## amitava82 (Nov 14, 2007)

Well Done!


----------



## vaibhavtek (Nov 22, 2007)

nice 1


----------



## bikdel (Nov 22, 2007)

+1

EDIT : can you tell me how to associate a web server with it to make it email me?.. im a noob in these things 

im gonna put this code in my blog


----------



## nvidia (Nov 22, 2007)

Thanks for the tutorial...


----------



## victor_rambo (Nov 22, 2007)

See this thread: *www.thinkdigit.com/forum/showthread.php?t=73786


----------



## anantkhaitan (Dec 17, 2007)

Thanks Subbu..


----------

