Share on Google+Share on Google+

Session Register

Advertisement
In this example you will learn how to create session register in PHP.

Session Register

For session register, you will have to first create an action form in HTML that calls the php session_register code.  

In PHP form, we have created email field, and added submit button while for calling php code, we have used server[PHP_SELF] call. 

<?php
session_start ();
if($_POST["submit"]){
$email=$_POST["email"];
session_register ("email");
echo "Your Email ID is ".$email;
}
?>

Creating HTML form action

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Session Register</title></head>
<body>
<form name="session" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<table width="80%" border="0" cellspacing="0" cellpadding="0" style="color:#333333;"> 

<tr> 
<td width="20%" height="27" style="padding-left:10px;">Email</td> 
<td width="32%">: <input type="text" name="email" class="inputbox" /></td> 
<td width="48%" align="left"></td>
</tr> 
<tr><td><input name="submit" type="submit" value="Submit" onClick="return validate(this);"/></td></tr> 
<tr> 
</table> 
</form> 
</body>
</html>

In the output, you will get your email id.

Advertisements

Advertisement

Posted on: July 31, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.