wheres the rest of it??
missing parts and edit does not work, insert needed tweaking?????
CREATE TABLE `register` ( `user_id` INT(11) NOT NULL AUTO_INCREMENT, `firstname` VARCHAR(100) NOT NULL, `lastname` VARCHAR(100) NOT NULL, `username` VARCHAR(100) NOT NULL, `password` VARCHAR(15) NOT NULL, `email` VARCHAR(100) NOT NULL, `contact` VARCHAR(20) NOT NULL, PRIMARY KEY (`user_id`) )
<head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="admin_style.css" type="text/css" media="screen" /> </head> <div class=""> <form id="frmuser" name="frmuser" action="register_formaction.php" method="post"> <table class=""> <tr> <td class="lab1"> </td> </tr> <tr> <td class="lab1"> </td> </tr> <tr> <td class="lab1"> </td> </tr> <tr> <td class="lab1"> </td> </tr> <tr> <td class="lab1"> </td> </tr> <tr> <td class="lab1"> </td> </tr> <tr> <td colspan="2" class="tab-log"> <input type="submit" id="insertuser" class="sub-form" name="submit" value="Add"> </td> </tr> </table> <br /> </form> </div>
$("#btnnewuser").on( "click", function(e) { dialog_newuser = $('<div></div>').load('register_form.php').dialog({ autoOpen: false, title:'Add new user', width: 600, height: 400 }); dialog_newuser.dialog('open'); });
$(document).on('click',"#insertuser", function(event){ event.preventDefault(); var formData = $("#frmuser").serialize(); $.ajax({ type: "POST", url: "register_formaction.php", data: formData, // contentType: false, // processData: false, dataType: 'JSON', success: function(response) { console.log(response.msg); if(response.status == true){ $('#emessageerr').hide(); $('#dmessage').show(); $('#gmsg').attr('class','alert alert-success'); $('#gmsg').html(response.msg); // alert(response.msg); dialog_newuser.dialog('close'); } else{ alert(response.msg); $('#dmessage').hide(); $('#emessageerr').show(); // $('#ghmsgerr').switchClass('alert alert-danger','alert alert-success'); $('#ghmsgerr').html(response.msg); } }, error: function(response) { alert(response.msg); $('#dmessage').hide(); $('#emessageerr').show(); // $('#ghmsgerr').switchClass('alert alert-danger','alert alert-success'); $('#ghmsgerr').html(response.msg); console.log(response. responseText); } }); });
$response['msg']= ""; $response['status']= FALSE;
<?php include('connect.php'); $response['msg']= ""; $response['status']= FALSE; $firstname = $_POST['fname']; $lastname = $_POST['lname']; $username = $_POST['uname']; $password = $_POST['pass']; $useremail = $_POST['email']; $usercontact = $_POST['contact']; if($firstname == '' ) { $response['msg']= "Firstname is empty"; $response['status']= FALSE; } else if($lastname == '') { $response['msg']= "Lastname is empty"; $response['status']= FALSE; } else if($username == '') { $response['msg']= "Username is empty"; $response['status']= FALSE; } else if($password == '') { $response['msg']= "Password is empty"; $response['status']= FALSE; } else if($useremail == '') { $response['msg']= "Usermail is empty"; $response['status']= FALSE; } else if($usercontact == '') { $response['msg']= "Contact is empty"; $response['status']= FALSE; } else { $insert_query = "insert into register(firstname, lastname, username, password, email, contact) values('$firstname', '$lastname', '$username', '$passwordmd5', '$useremail', '$usercontact')"; { $response['msg']= "Susscessfully Inserted"; $response['status']= TRUE; } else{ $response['msg']= "Insertion error"; $response['status']= FALSE; } } } else{ $response['msg']= "Invalied post"; $response['status']= FALSE; } ?>
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.