Simple PHP Tutorial

Status
Not open for further replies.

[xubz]

"The Cake is a Lie!!"
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
 

bikdel

Alpha Geek Banned
+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
 
Last edited:
Status
Not open for further replies.
Top Bottom