Question

Need a php page the will take information the users put in the form fields and...

Need a php page the will take information the users put in the form fields and update the an SQL database. Please write the code that takes the users inputs and puts the data towards an SQL database.



Register

Please fill in this form to create an account.

Email

Password

Repeat Password

By creating an account you agree to our Terms & Privacy.

Register


  


Have an account?Sign In

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Qo.

ANS:

Registration Form Code(HTML+BS4):

Create the Following files (IMAGE)

File1 Code: index1.php

<!DOCTYPE html>
<html lang="en" >
<head>
   <meta charset="UTF-8">
   <title>Login and SignUp Form/Forget Password Code</title>
   <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,300,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <style>
   .signup-success{
       font-size: 16px;
       color: #fff;
   }
   </style>
   <script src="popup/enq.js" type="text/javascript"></script>
</head>
<body>
   <div class="form">
       <ul class="tab-group">
           <li class="tab active"><a href="#signup">Sign Up</a></li>
           <li class="tab"><a href="#login">Log In</a></li>
       </ul>
       <div class="tab-content">
           <div id="signup">   
               <h1>Sign Up for Free</h1>
               <?php
                   session_start();
                   if(isset($_SESSION['signup_fname']))
                   {
                       echo "<p class='signup-success'> &#x2714; Thanks ".$_SESSION['signup_fname']."! Signup Successfully Done, Now Login</p>";
                   }
                  
               ?>
               <form action="tech-signup.php" method="post">
                   <div class="top-row">
                       <div class="field-wrap">
                       <label>First Name<span class="req">*</span></label>
                       <input type="text" name="firstName" required="required" autocomplete="off"/>
                       </div>
                       <div class="field-wrap">
                       <label>Last Name<span class="req">*</span></label>
                       <input type="text" name="lastName" required="required" autocomplete="off"/>
                       </div>
                   </div>
                   <div class="field-wrap">
                       <label>Email Address<span class="req">*</span></label>
                       <input type="email" name="userEmail" required="required" autocomplete="off"/>
                   </div>
                   <div class="field-wrap">
                       <label>Enter Password<span class="req">*</span></label>
                       <input type="password" name="userPassword" required="required" autocomplete="off"/>
                   </div>
                   <div class="field-wrap">
                       <label>Confirm Password<span class="req">*</span></label>
                       <input type="password" name="userCPassword" required="required" autocomplete="off"/>
                   </div>
                   <div>
                       <span><input type="checkbox" name="accept_checkbox" id="accept_checkbox"/></span>
                       <span><label for="accept_checkbox">By creating an account you agree to our <a href="">Terms & Privacy</a></label></span>
                   </div>
                   <input type="submit" class="button button-block" value="Register"/>
               </form>
           </div>
           <div id="login">   
               <h1>Welcome
                   <?php if(isset($_SESSION['signup_fname']))
                       echo $_SESSION['signup_fname'].'!';
                   ?>
               </h1>
               <form action="tech-signin.php" method="post">
                   <div class="field-wrap">
                       <label>Email Address<span class="req">*</span></label>
                       <input type="email" name="userEmail" required="required" autocomplete="off"/>
                   </div>
                   <div class="field-wrap">
                       <label>Password<span class="req">*</span></label>
                       <input type="password" name="userPassword" required="required" autocomplete="off"/>
                   </div>
                   <p class="forgot"><a href="#" data-toggle="modal" class="forget-link" data-target="#forgetModal">Forgot Password?</a></p>
                   <input type="submit" class="button button-block" value="Log In"/>
               </form>
           </div>
       </div><!-- tab-content -->
   </div> <!-- /form -->
   <!-- Modal -->
       <div class="modal fade" id="forgetModal" role="dialog">
           <div class="modal-dialog modal-sm">
           <div class="modal-content">
               <div class="modal-header">
               <button type="button" class="close" data-dismiss="modal">&times;</button>
               <h4 class="modal-title">Reset Passowrd?</h4>
               </div>
               <div class="modal-body">
                   <h4 class="statusMsg"></h4>
                   <form method="post" role="form">
                       <div class="form-group">
                           <input type="email" id="inputEmail" class="form-control" name="reset-email" required="required" placeholder="Enter your email to reset password"/>
                       </div>
                       <div class="form-group">
                           <input type="submit" class="btn btn-sm btn-success submitBtn" onclick="submitContactForm()" name="reset-button" value="Send Password"/>
                       </div>
                   </form>
               </div>
           </div>
           </div>
       </div>
   <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>

File2 Code: style.css (inside css folder make a file name style.css)

*, *:before, *:after {
box-sizing: border-box;
}

html {
overflow-y: scroll;
}

body {
background: #c1bdba;
font-family: 'Titillium Web', sans-serif;
}

a {
text-decoration: none;
transition: .5s ease;
}
a:hover {
color: #179b77;
}

.form {
background: #2959A8;
padding: 40px;
max-width: 600px;
margin: 40px auto;
border-radius: 4px;
box-shadow: 0 4px 10px 4px rgba(19, 35, 47, 0.3);
}

.tab-group {
list-style: none;
padding: 0;
margin: 0 0 40px 0;
}
.tab-group:after {
content: "";
display: table;
clear: both;
}
.tab-group li a {
display: block;
text-decoration: none;
padding: 15px;
background: #000;
color: #a0b3b0;
font-size: 20px;
float: left;
width: 50%;
text-align: center;
cursor: pointer;
transition: .5s ease;
}
.tab-group li a:hover {
background: #E73638;
color: #fff;
}
.tab-group .active a {
background: #fff;
color: #000;
}

.tab-content > div:last-child {
display: none;
}

h1 {
text-align: center;
color: #ffffff;
font-weight: 300;
margin: 0 0 40px;
}

div>label {
position: absolute;
-webkit-transform: translateY(6px);
transform: translateY(6px);
left: 13px;
color: rgba(255, 255, 255, 0.5);
transition: all 0.25s ease;
-webkit-backface-visibility: hidden;
pointer-events: none;
font-size: 22px;
}
div>label .req {
margin: 2px;
color: #1ab188;
}

div>label.active {
-webkit-transform: translateY(50px);
transform: translateY(50px);
left: 2px;
font-size: 14px;
}
div>label.active .req {
opacity: 0;
}

div>label.highlight {
color: #ffffff;
}

div>input, textarea {
font-size: 22px;
display: block;
width: 100%;
height: 100%;
padding: 12px 10px;
background: none;
background-image: none;
border: 1px solid #a0b3b0;
color: #ffffff;
border-radius: 0;
transition: border-color .25s ease, box-shadow .25s ease;
}
div>input:focus, textarea:focus {
outline: 0;
border-color: #1ab188;
}

textarea {
border: 2px solid #a0b3b0;
resize: vertical;
}

.field-wrap {
position: relative;
margin-bottom: 40px;
}

.top-row:after {
content: "";
display: table;
clear: both;
}
.top-row > div {
float: left;
width: 48%;
margin-right: 4%;
}

.top-row > div:last-child {
margin: 0;
}

.button {
border: 0;
outline: none;
border-radius: 0;
padding: 15px 0;
font-size: 2rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: .1em;
background: #fff;
color: #000;
transition: all 0.5s ease;
-webkit-appearance: none;
}
.button:hover, .button:focus {
cursor: pointer;
background: #E73638;
color: #fff;
}

.button-block {
display: block;
width: 100%;
}

.forgot {
margin-top: -20px;
text-align: right;
}
.forget-link{
   color: #fff !important;
}

File3 Code: index.js (inside js folder)

$('.form').find('input, textarea').on('keyup blur focus', function (e) {
  
var $this = $(this),
label = $this.prev('label');

   if (e.type === 'keyup') {
           if ($this.val() === '') {
label.removeClass('active highlight');
} else {
label.addClass('active highlight');
}
} else if (e.type === 'blur') {
   if( $this.val() === '' ) {
       label.removeClass('active highlight');
           } else {
       label.removeClass('highlight');   
           }   
} else if (e.type === 'focus') {
  
if( $this.val() === '' ) {
       label.removeClass('highlight');
           }
else if( $this.val() !== '' ) {
       label.addClass('highlight');
           }
}

});

$('.tab a').on('click', function (e) {
  
e.preventDefault();
  
$(this).parent().addClass('active');
$(this).parent().siblings().removeClass('active');
  
target = $(this).attr('href');

$('.tab-content > div').not(target).hide();
  
$(target).fadeIn(600);
  
});

File4 Code: s-config.php (Database Connection File)

<?php   
   $servername = "localhost";
   $db_username = "root";
   $db_password = "";
   $dbname = "forget"; //Database name
?>

File5 Code: tech-signup.php (to register any user and insert into db)

<?php
   session_start();
   $error="Some problem Occured, Please SignUp Again!";
   $fname=$_REQUEST['firstName'];
   $lname=$_REQUEST['lastName'];
   $email=$_REQUEST['userEmail'];
   $password=$_REQUEST['userPassword'];
  
   include_once 's-config.php';
   $signup_db=mysqli_connect($servername,$db_username,$db_password,$dbname);
   $signup_query="INSERT into transactions(userfname,userlname,useremail,userPassword,user_signup_date_time) VALUES('$fname','$lname','$email','$password','NOW()')";
       if (mysqli_query($signup_db,$signup_query))
       {
           $_SESSION['signup_fname'] = $fname; // Initializing Session
           header("location: index1.php"); // Redirecting To Other Page
       }
       else{
           $_SESSION['signup_error']=$error;
           header("Location:index1.php");
       }
   mysqli_close($connection); // Closing Connection
?>

Database Structure IMAGE:

OUTPUT IMAGE:

Run on localhost

After Registering the user, the output is: (IMAGE)

After Registering database (IMAGE)

Still problem?? comment us..okay

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

THANKS!!

Add a comment
Know the answer?
Add Answer to:
Need a php page the will take information the users put in the form fields and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow...

    How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow user to add his name and email to my database, all I need to print my final database when the user click on submit. <form action="" method="post"> <label>Name :</label> <input type="text" name="name" required="required" placeholder="Please Enter Name"/><br /><br /> <label>Email :</label> <input type="email" name="email" required="required" /><br/><br /> <input type="submit" value=" Submit " name="submit"/><br /> </form>...

  • I need help please to add function for clean up any inputs form that we receive from the users for this code below : &lt...

    I need help please to add function for clean up any inputs form that we receive from the users for this code below : <?php session_start(); // initializing variables $fname = ""; $lname = ""; $address = ""; $city = ""; $state = ""; $zip = ""; $email = ""; $phone = ""; $errors = array(); // connect to the database $db = mysqli_connect("localhost","root","password","db"); // REGISTER USER if (isset($_POST['reg_user1'])) { // receive all input values from the form $fname =...

  • For this code below, I need to add the form information to mysql when I click...

    For this code below, I need to add the form information to mysql when I click on submit, at the same time when I click on submit I need to move to another page like Welcome.php WITH NOTE THAT THE ENTERED INFORMATION NOW ALREADY IN DATABASE how can I male that with my code below? THANKS ................................................................................................................................................   <form method="POST"> <div class="container">    <label for="fname"><b>First Name</b></label> <input type="text" placeholder="Enter First Name" name="fname" required> <label for="lname"><b>Last Name</b></label> <input type="text" placeholder="Enter Last Name"...

  • Using PHP and MySQL, create a Web page to be used for storing software development bug reports in...

    Using PHP and MySQL, create a Web page to be used for storing software development bug reports in a MySQL database. Include fields such as product name and version, type of hardware, operating system, frequency of occurrence, and proposed solutions. Include links on the main page that allow you to create a new bug report and update an existing bug report. I have tried the various solutions provided previously for this exercise, but it does not work because every author...

  • I need html coding in notepad++ according to the requirments those are listed in the pictures....

    I need html coding in notepad++ according to the requirments those are listed in the pictures. The purpose of this assignment is to figure out the designing and development of HTML forms with CSS and interaction between users and forms by using the Javascript script language. Below Student Registration Form views some form inputs entered by users and shows in the form as a response. Resources: All posted class documents and lab practices will help to complete this assignment. Student...

  • Form Processing HTML One of the most ubiquitous uses of JavaScript is validating form data on...

    Form Processing HTML One of the most ubiquitous uses of JavaScript is validating form data on the client side before it is submitted to the server. It is done everywhere because it is fast and it gives you a great deal of flexibility in how you handle errors insofar as the GUI is concerned. Attached is an image of some code I wrote (so Blackboard can't mess it up). Some things to notice that will help you with the lab....

  • In this project, you will construct an Object-Oriented framework for a library system. The library must...

    In this project, you will construct an Object-Oriented framework for a library system. The library must have books, and it must have patrons. The patrons can check books out and check them back in. Patrons can have at most 3 books checked out at any given time, and can only check out at most one copy of a given book. Books are due to be checked back in by the fourth day after checking them out. For every 5 days...

  • The first script is validate.sh. This is a simple form validation script that will be used...

    The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT