Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="js/click.js"></script>
- <form action="click.js" method="post">
- <label for="first_name">First Name:</label>
- <input type="text" id="first_name" name="first_name" /><br>
- <label for="last_name" >Last Name:</label>
- <input type="text" id="last_name" name="last_name" /><br>
- <label for="username">Username:</label>
- <input type="text" id="username" name="username" /><br>
- <label for="password">Password:</label>
- <input type="text" id="password" name="password" /><br>
- <label for="email">Email:</label>
- <input type="email" id="email" name="email" /><br>
- <button type="submit" id="reg-submit" name="submit">Submit</button>
- </form>
- $(document).ready(function(){
- $('#reg-submit').click(function() {
- var firstName = $('#first_name').val();
- var lastName = $('#last_name').val();
- var userName = $('#username').val();
- var password = $('#password').val();
- var email = $('#email').val();
- var dataString = 'name1=' + firstName + '&lastname1=' + lastName + '&user1=' + userName + '&password1=' + password + '&email1=' + email;
- if (firstName == "" || lastName == "" || userName == "" || password == "" || email == "") {
- alert('missing some information');
- } else {
- $.ajax({
- type: "POST",
- url: "usersubmit.php",
- data: dataString,
- cache: false,
- success: function(){
- $('#main-content').load('php/next-page.php').hide().fadeIn('slow');
- }
- });
- };
- return false;
- });
- });
- <?php
- include 'users_db.php';
- $first1=$_POST['name1'];
- $last1=$_POST['lastname1'];
- $username1=$_POST['user1'];
- $pass1=$_POST['password1'];
- $email01=$_POST['email1'];
- $userinfo = $conn->prepare("INSERT INTO registered_users (FirstName, LastName, Username, Password, Email) VALUES ('$first1', '$last1', '$username1'', '$pass1', '$email01')");
- $userinfo->execute();
- $conn = null;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement