Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if ($_GET["page"]=="manage"){
- if(empty($_GET["id"])) {
- header("location:member.php");
- }
- else {
- $data_userid=$_GET["id"];
- }
- $tablename="user";
- $query= "SELECT * FROM $tablename WHERE user_id='$data_userid'";
- $result= mysqli_query($connection, $query) or die(mysqli_error($connection));
- $count= mysqli_num_rows($result);
- while($row=mysqli_fetch_assoc($result)) {
- $datauserid=$row['user_id'];
- $datausername=$row['username'];
- $datapassword=$row['password'];
- $datafirstname=$row['firstname'];
- $datalastname=$row['lastname'];
- $datagender=$row['gender'];
- $dataaddress=$row['address'];
- $datacontactnumber=$row['contactnumber'];
- $tablename="user";
- }
- ?>
- <br/>
- <br/>
- <center>
- <form name="editAccountForm" id="editAccountForm" method="POST" action="editaccount.php" >
- <table name="guestTable" id="guestTable" border="1" >
- <tr><th >Username</th>
- <td><input style="width:430px; text-align: center" type="text" name="username" value="<?php echo $datausername; ?>"/></td>
- </tr>
- <tr><th >Password</th>
- <td><input style="width:430px; text-align: center" type="text" name="password" value="<?php echo $datapassword; ?>" /></td>
- </tr>
- <tr><th >First Name</th>
- <td><input style="width:430px; text-align: center" type="text" name="prod_price" value="<?php echo $datafirstname; ?>" /></td>
- </tr>
- <tr><th >Last Name</th>
- <td>
- <input style="width:430px; text-align: center" type="text" name="lastname" value="<?php echo $datalastname; ?>" /></td>
- </td>
- </tr>
- <tr><th >Address</th>
- <td>
- <input style="width:430px; text-align: center" type="text" name="address" value="<?php echo $dataaddress; ?>" /></td>
- </td>
- </tr>
- <tr><th >Contact Number </th>
- <td>
- <input style="width:430px; text-align: center" type="text" name="contactnumber" value="<?php echo $datacontactnumber; ?>" /></td>
- </td>
- </tr>
- </table><br/>
- <input type="submit" value="Save Changes" />
- </form>
- </center>
- <?php
- }
- ?>
- <?php
- $connect_servername="localhost";
- $connect_username="root";
- $connect_password="";
- $connect_dbname="woven_data";
- $connection = mysqli_connect($connect_servername, $connect_username, $connect_password);
- if (!$connection){
- die("Database Connection Failed".mysqli_error($connection));
- }
- $select_db = mysqli_select_db($connection, $connect_dbname);
- if (!$select_db){
- die("Database Selection Failed".mysqli_error($connection));
- }
- if (isset($_POST['username'])
- and isset($_POST['password'])
- and isset($_POST['firstname'])
- and isset($_POST['lastname'])
- and isset($_POST['gender'])
- and isset($_POST['address'])
- and isset($_POST['contactnumber'])
- ){
- $datauserid=$_POST['user_id'];
- $datausername=$_POST['username'];
- $datapassword=$_POST['password'];
- $datafirstname=$_POST['firstname'];
- $datalastname=$_POST['lastname'];
- $datagender=$_POST['gender'];
- $dataaddress=$_POST['address'];
- $datacontactnumber=$_POST['contactnumber'];
- $tablename="user";
- $query="UPDATE $tablename
- SET username='$datausername', password='$datapassword',
- firstname='$datafirstname', lastname='$datalastname',
- gender='$datagender', address='$dataaddress', contactnumber='$datacontactnumber'
- WHERE user_id='$datauserid' ";
- $result=mysqli_query($connection, $query) or die(mysqli_error($connection));
- if ($result){
- header("location:member.php?page=manage&id=$datauserid");
- }
- else{
- header("location:javascript://history.go(-1)");
- }
- }
- ?>
Add Comment
Please, Sign In to add comment