Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('connect.php');
- if(isset($_POST['UserID'])) {
- $sql_insert = sqlquery("UPDATE User SET LoginName='{$_POST['LoginName']}', FirstName='{$_POST['FirstName']}', SurName='{$_POST['SurName']}', Password='{$_POST['Password']}' WHERE UserID='{$_POST['UserID']}'");
- $message = "<script>alert('User updated.');</script>";
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <link rel="stylesheet" type="text/css" href="cssmain.css">
- <meta charset="UTF-8">
- <title>Edit User</title>
- </head>
- <body>
- <div class="navbar" align="left">
- <ul>
- <li><a href="index.php">Home</a></li>
- <li><a href="addGrade.php">Add Grade</a></li>
- <li><a class="active" href="addUser.php">Add User</a></li>
- <li><a href="addCourse.php">Add Course</a></li>
- <li><a href="login.php">Login</a></li>
- </ul>
- </div>
- <div>
- <div align="left" class="blackline"></div>
- </div>
- <div align="center" class="content">
- <?php
- if(isset($_SESSION['username'])) {
- echo 'Username: <b>'.$_SESSION['username'].'</b>, <a href="logout.php">logout</a>';
- }
- ?>
- <h1>Edit User</h1>
- <p>Adding and edditing BTEC somester content</p>
- <?php
- if(!empty($_POST)) {
- if(isset($_POST['selectstudent'])) {
- echo '
- <form method="post" action="edit.php">
- <br><h3>Edit:</h3>
- <input type="hidden" name="UserID"><br>
- First Name:
- <input type="text" name="FirstName"><br>
- Surname:
- <input type="text" name="SurName"><br>
- Username:
- <input type="text" name="LoginName"><br>
- Password:
- <input type="text" name="Password"><br>
- <input type="submit" value="Update"><br>
- </form>
- ';
- }
- } else {
- $sql = sqlquery("SELECT UserID, LoginName FROM User");
- echo '<form action="userEditted.php" method="POST">';
- echo '<select name="options">';
- while ($row = mysqli_fetch_array($sql)) {
- echo '<option value="'.$row['UserID'].'">' . $row['LoginName'] . '</option>';
- }
- echo '</select>';
- echo '<input type="submit" value="Select" name="selectstudent">'
- echo '</form>';
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement