Skip to main content

log in system in php and html

Log in system in php and html

step1 :- create a form for user information used to store

<form action="" metho="post">
<table> 
<tr><td>Name</td><td><input type='text' name='name'></td></tr>
<tr><td>Email</td><td><input type='text' name='email'></td></tr>
<tr><td>Address</td><td><input type='text' name='address'></td></tr>
<tr><td colspan='2'><input type="submit"  value="submit" > </td> </tr>
</table>
</form>
step2:- php code top of the page 
  
if(isset($_REQUEST['submit']))
{
 
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$address=$_REQUEST['address'];
//validation in php
if(!empty($name))
{
if(!empty($email))
{ if(filter_var($email , FILTER_VALIDATE_EMAIL))
{ if(!empty($address))
{


 //now create a connection in mysql database
$con=mysqli_connect("localhost","root","","saddam");
$sql="insert into user (name,email,addres)value('$name','$email','$address')";
$query=mysqli_query($con,$sql);
 if($query)
{
mysqli_query("COMMIT");
 
}
else
{
mysqli_query("ROLBACK");

}
echo mysql_affected_rows($con);


$sql1="select * from user";
$query1=mysqli_query($con,$sql1);
 ?>


<table> 
<tr><td>Name</td><td>Email</td><td>Address </td></tr>
 <?php while($row=mysqli_fetch_array($query1)){?>
<tr><td><?php $row['name'];?></td><td><?php $row['email'];?></td><td><?php $row['address'];?></td></tr> <?pgp }?>
 </table>
<?php }


}else{
echo "enter your  address ";
 }

}else{
echo "enter valid  email address ";
 }
 
}else{
echo "enter your email address ";
 }

}else{
echo "enter your name ";
 }

?>

Comments

Popular posts from this blog

FILE UPLOAD IN PHP BY USEING FORM | PHP FILE UPLOADS

FILE UPLOAD IN PHP  BY USEING FORM | PHP FILE UPLOADS INDEX.PHP //PAGE <!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> </head> <body> <form method="post" action="upload.php" enctype="multipart/form-data"> <input type="file" name="posters" /> <input type="submit" value="upload" name="submit" /> </form> </body> </html> upload.php //PAGE <?php if($_FILES) { $name=$_FILES['posters']['name']; $type=$_FILES['posters']['type']; $extension=array('jpeg','jpg','JPEG','JPG','...