When we need to design a PHP login system or login PHP. We can make it simply by using Jquery and have to know basic PHP code. It’s a combination of a simple PHP and JavaScript codes.
In this post, I will share a knowledge how to make login form design with login PHP code and JavaScript. Also, I will provide you Source Code for make the login PHP form better.
Check Another Related Post:
1. Make Facebook Style Notification Popup Using CSS and Jquery Codes
2. Create Youtube like Rating with Jquery and Ajax
3. How To Make Loading Banner Advertisements With Jquery
4. How To Make Live Character Count Meter with Jquery
Source: 9lessons |
Make Login PHP Form With Login PHP Code
So, people let’s see how we describe here how can you make login PHP or PHP login form.
JavaScript Code
$(‘#signup’).click(function(){} – signup is the ID of the radio. Using $(“#login_block”).hide() hide the login block and $(“#signup_block”).show() shows signup block.
<script type=”text/javascript” src=”http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js”></script>
<script type=”text/javascript”>
$(document).ready(function()
{
$(‘#signup’).click(function()
{
$(‘#password’).val(”);
$(‘#login_block’).hide();
$(‘#signup_block’).show();
});
$(‘#login’).click(function()
{
$(‘#newpassword’).val(”);
$(‘#signup_block’).hide();
$(‘#login_block’).show();
});
});
</script>
HTML Code
<form method=”post” action=”loginup.php”>
<div>
<label>Email</label> <br/>
<input type=”text” name=”email”/><br />
<input type=”radio” name=”choose” id=”login” checked=”checked”/> I have an account <br />
<input type=”radio” name=”choose” id=”signup”/> I am new!<br />
</div>
<div id=”login_block”>
<label>Password</label><br />
<input type=”password” name=”password” id=”password”/><br/>
<input type=”submit” value=” Login “/>
</div>
<div id=”signup_block” style=”display:none”>
<label>Choose password</label><br/>
<input type=”password” name=”newpassword” id=”newpassword” /><br/>
<input type=”submit” value=” Signup “/>
</div>
</form>
login.php
<?php
if($_POST)
{
$email = $_POST[’email’];
$password = $_POST[‘password’];
$newpassword = $_POST[‘newpassword’];
if($_POST[‘password’] && $_POST[’email’])
{
$sql=mysql_query(“SQl select statement”);
echo “Login success”;
}
else if($_POST[‘newpassword’] && $_POST[’email’])
{
$sql=mysql_query(“SQl Insert values statement”);
echo “Registration Success”;
}
}
?>
These are the source code for making your login PHP or PHP login form.
Hopefully, you can able to create or build a nice design like I provided the image. If you have any question about these codes don’t avoid the comment section for asking me. I will try to give your answers. Sharing is caring, please share it on your social media with others.