DIGIT-ARC read-only archive · snapshot: July 23, 2026

Simple PHP Tutorial

7 posts · originally from https://geek.digit.in/community/threads/simple-php-tutorial.73148/

[xubz]
[xubz] Original post #1
Nov 14, 2007 at 1:19 AM
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
Code:
<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 at 1:28 AM
Well Done!
V
vaibhavtek #3
Nov 22, 2007 at 6:32 PM
nice 1
bikdel
bikdel #4
Nov 22, 2007 at 6:50 PM
+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 :D
nvidia
nvidia #5
Nov 22, 2007 at 6:54 PM
Thanks for the tutorial...
victor_rambo
Nov 22, 2007 at 7:26 PM
See this thread: *www.thinkdigit.com/forum/showthread.php?t=73786