Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><body background = "vv.jpg">
- </html>
- <?php
- echo '<h1>Edit a User</h1>';
- if ((isset($_GET['id'])) && (is_numeric($_GET['id']))){
- $id=$_GET['id'];
- } else if ((isset($_GET['id'])) && (is_numeric($_GET['id']))){
- $id=$_GET['id'];
- }else {
- echo'<p class="error">This page has been accessed in error.</p>';
- exit();
- }
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "test";
- // Create connection
- $link = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }
- $q="SELECT firstname, mobilenum from users where user_id=$id";
- $result=@mysqli_query($link,$q);
- if (mysqli_num_rows($result)==1){
- $row=mysqli_fetch_array($result,MYSQLI_NUM);
- echo '<form action="edit_user.php" method="post">
- <p>Name: <input type="text" name="firstname" size="15" maxlength="15" value "' .$row[0].'"/ required></p>
- <p>Username: <input type="text" name="mobilenum" size="15" maxlength="15" value "' .$row[1]. '"/required></p>
- <p><input type="submit" name="sure" value="submit"/></p>
- </form>';
- } else {
- echo '<p class= "error">This page has been accessed in error.</p>';
- }
- mysqli_close($link);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement