I'm just looking to set up a simple registration form for my website, and was wondering if anyone could recommend a fairly straightforward tutorial...

Thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style12 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style28 {color: #FF0000}
.style29 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
</head>


<body>
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><div align="justify">
<form action="submit.php" method="post" name="regform" id="regform" onsubmit="return Validate()">
<table width="75%"  border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td bgcolor="#E54F1A"><table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#FEF7F3">&nbsp;</td>
</tr>
<tr>
<td align="right" bgcolor="#FEF7F3"><span class="style28">*</span> Fields are Manditory&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FEF7F3">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FEF7F3"><table width="90%" height="320"  border="0" align="center" cellpadding="3" cellspacing="0">
<tr bgcolor="#FEF7F3" class="style29">
<td>Name <span class="style28">*</span> </td>
<td align="center">:</td>
<td class="style29"><input name="name" type="text" id="name" size="21" /></td>
</tr>
<tr bgcolor="#FEF7F3" class="style29">
<td>Address<span class="style28">*</span></td>
<td align="center">:</td>
<td class="style29"><textarea name="address" cols="16" rows="4" wrap="virtual"  id="address"></textarea></td>
</tr>
<tr bgcolor="#FEF7F3" class="style29">
<td>Phone Number <span class="style28">*</span> </td>
<td align="center">:</td>
<td class="style29"><input name="phone" type="text" id="phone" size="21"   onkeyup="Only_Num(this.id)" /></td>
</tr>
<tr bgcolor="#FEF7F3" class="style29">
<td>Mobile Number<span class="style28">*</span> </td>
<td align="center">:</td>
<td class="style29"><input name="mobile" type="text" id="mobile" size="21" onchange="Javascript:LA()"  onkeyup="Only_Num(this.id)" /></td>
</tr>
<tr bgcolor="#FEF7F3" class="style29">
<td>E-Mail ID <span class="style28">*</span> </td>
<td align="center">:</td>
<td class="style29"><input name="email" type="text" id="email" size="21" /></td>
</tr>
<tr bgcolor="#FEF7F3" class="style29">
<td height="97">Comments <span class="style28">*</span> </td>
<td align="center">:</td>
<td class="style29"><textarea name="comments" cols="16" rows="5" wrap="virtual" id="comments"></textarea></td>
</tr>
<tr align="center" bgcolor="#FEF7F3" class="style29">
<td colspan="3" class="style12"><input name="Submit" type="submit" class="style29" id="Submit" value="Submit" onclick="return chk()" />
<input name="Reset" type="reset" class="style29" value="Reset" />
<script>//global variable for error flag
var errfound = false;
//function to validate by length
function ValidLength(item, len) {
return (item.length >= len);
}
//function to validate an email address
function ValidEmail(item) {
if (!ValidLength(item, 5)) return false;
if (item.indexOf ('@', 0) == -1) return false;
return true;
}
// display an error alert
function error(elem, text) {
// abort if we already found an error
if (errfound) return;
window.alert(text);
elem.select();
elem.focus();
errfound = true;
}
// main validation function
function Validate() {
errfound = false;
if (!ValidLength(document.regform.name.value,6))
error(document.regform.name,"Name : minimum 6 characters");
if (!ValidLength(document.regform.address.value,10))
error(document.regform.address, "Invalid  Address");
if (!ValidLength(document.regform.phone.value,10))
error(document.regform.phone,"Invalid phone number");
if (!ValidLength(document.regform.mobile.value,10))
error(document.regform.mobile,"Invalid mobile number");
if (!ValidEmail(document.regform.email.value))
error(document.regform.email, "Invalid Email Address");


if (!ValidLength(document.regform.comments.value,5))
error(document.regform.comments, "please Enter Your Comments");
return !errfound; /* true if there are no errors */
}
</script><script language="JavaScript">



function Only_Num(id) {
if(isNaN(document.getElementById(id).value)) {
alert("Please Enter Numbers Only (0-9)..");
document.getElementById(id).select();
document.getElementById(id).value=""
document.getElementById(id).focus();
}
return;
}
</script>
</td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#FEF7F3">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FEF7F3">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</form>
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>


</body>
</html>


Submit.php


<?
if($_SERVER=="POST")
{


$mail_body.='<style type=text/css><!-- body,td,th {font-family: Arial, Helvetica, sans-serif; font-size: 12px;color: #666666;}--></style>
<table width=60%  border=0 align=center cellpadding=1 cellspacing=0>
<tr>
<td bgcolor=#E54F1A><table width=100%  border=0 align=center cellpadding=3 cellspacing=0 bgcolor=#FFFFFF>
<tr align=center bgcolor=#FEF7F3>
<td colspan=3><strong>Feedback Form</strong></td>
</tr>
<tr bgcolor=#FEF7F3>
<td width=26% >Name </td>
<td width=3% align=center>:</td>
<td width=71% >'.$_POST.'</td>
</tr>
<tr bgcolor=#FEF7F3>
<td width=26% >Addresse </td>
<td width=3% align=center>:</td>
<td width=71% >'.$_POST.'</td>
</tr>



<tr bgcolor=#FEF7F3>
<td>Phone Number </td>
<td align=center>:</td>
<td>'.$_POST.'</td>
</tr>
<tr bgcolor=#FEF7F3>
<td>Mobile Number </td>
<td align=center>:</td>
<td>'.$_POST.'</td>
</tr>
<tr bgcolor=#FEF7F3>
<td>E-Mail ID</td>
<td align=center>:</td>
<td>'.$_POST.'</td>
</tr>
<tr bgcolor=#FEF7F3>
<td valign=top>Comments </td>
<td align=center valign=top>:</td>
<td>'.$_POST.'</td>
</tr>
</table></td>
</tr>
</table>';
//echo $mail_body;exit;
$mailto = 'dfghgf@dfhgf.com';


$from='hfgjhf@dfgf.com';
$mailheader.="Return-Path: ".$from."\n";
$mailheader .= "From: ".$from."\n";
$mailheader .= 'MIME-Version: 1.0' . "\r\n";
$mailheader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$mailheader.='From:'.$_POST. "\r\n";


@mail($mailto,'Feedback Form',$mail_body,$mailheader);
echo '<script language="javascript">window.location.href="thankyou.php";</script>';
}
?>

Just look like this..but u have to change names ....what u want...

Edited 3 Years Ago by happygeek: fixed formatting

I've met your best friend. And he told me to check out a particular forum called Daniweb for helpful advice. :)

I've met your best friend. And he told me to check out a particular forum called Daniweb for helpful advice. :)

Smart answer..............

This article has been dead for over six months. Start a new discussion instead.