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

how send mail using Swift mailer | switmailer send mail tutorial

how send mail using Swift mailer | switmailer send mail tutorial  <?php /* step 1 include Swift mailer file ;  */ include("vendor/swiftmailer/swiftmailer/lib/swift_required.php"); /* step 2 create your user details */ $senderEmail="saddam1234321@gmail.com"; $senderPassword="****Your password****"; $senderName="Saddam huassin"; /* step 3 set SMTP host  for sending mail  */ $user = Swift_SmtpTransport::newInstance('smtp.gmail.com','587','tls'); /* step 4 set your user details  */ $user->setUsername($senderEmail); $user->setPassword($senderPassword); /* step 5 create swift  mailer instance with a variable */ $mailer = Swift_Mailer::newInstance($user); /* step 6 Create a message */ $message = Swift_Message::newInstance('Wonderful Subject')   ->setFrom(array($senderEmail => $senderName))   ->setTo(array($senderEmail))   ->setBody('Here is the message itsel...

how install Swift mailer in localhost | swift mailer installation | composer install swift mailer

how install Swift mailer in localhost | swift mailer installation | composer install swift mailer Step 1:- open cmd  Step 2;- copy this command " composer required swiftmailer/swiftmailer @stable " . Step 3;- paste in cmd and press enter. Step 4;- after few second swift mailer ready to use .................................