Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6202593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:45:46+00:00 2026-05-24T04:45:46+00:00

I am developing my first simple website using PHP. Now, I am working in

  • 0

I am developing my first simple website using PHP. Now, I am working in the admin page and I want to let him adding, deleting users and editing the personal information of the existed users. I did the adding and deleting. Now, I want to develop editing users. First of all, I want him to choose the user from drop list, then fetch the user information automatically after choosing him from the drop list, and after that editing his information. So how can I do that?

My code:

<?php
ob_start();
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="13524"; // Mysql password
$db_name="sharingi_db"; // Database name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script language="javascript">
    function reload(form){
        var val=form.username.options[form.username.options.selectedIndex].value;
        self.location='editUser2.php?username=' + val ;
    }
    </script>
</head>
<body>

<div id="content_main" class="admin_student_height">

<!-- Here starts the first form -->
<form method="get">
        <h3>Choose A User</h3> <br />
        select name="username" onchange="reload(this.form)">

                <option> 
        <?php
           if(isset($_GET['username']))
           echo "{$_GET['username']}"; 
           else echo "Select one";
        ?> 
            </option>

                <?php
                   if(isset($_GET['username'])){
           $exceptcc = $_GET['username'];
           $sql = "SELECT username FROM user WHERE user.username NOT IN
                                 ('$exceptcc')";
                    }
           else 
           $sql = "SELECT username FROM user";
           $result = mysql_query($sql);
           while($row = mysql_fetch_array($result)){
           echo "<option value={$row['username']}>{$row['username']}</option>";
                                }
        ?>
        </select><br /><br />

        <h3>User Information</h3> <br />
        <?php 
           $thecc = $_GET['username'];
           $sql = "SELECT Firstname FROM user WHERE Username=$thecc";
           $result = mysql_query($sql);
           while($row = mysql_fetch_array($result)){
           echo "{$row['Firstname']}>{$row['Firstname']}}";
                                }
        ?>
        <br /><br />
        </form> <br />

        </div>
    </div>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:45:47+00:00Added an answer on May 24, 2026 at 4:45 am

    I’ve been working on making a web-based ticketing system and ran into this same situation.
    I solved the problem like this:

    1. When the page is loaded, determine if they have admin rights or throw them off the page.
    2. Do an SQL Query to get the List of users, to either display in a list or in a drop down box.
    3. Once the User to edit has been selected, Do another Query and load each item into a field;
      what I did was use the same form for adding new users but have php build the form and insert the current values for that user into the fields.
    4. When this form is submitted, (and submitter verifed) I have the php script look at the submitted username and use that for the where clause in the sql update statement

    If you want me to post up an example of what I did I can do that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're developing a new eCommerce website and are using NHibernate for the first time.
When first developing an PHP app (MySQl, but using ODBC interfaces to allow for
I'm developing my first MVC website and I'm experimenting with the few available grids
I've been developing my first iPhone app part-time and would like to start using
I'm developing my first java application using Eclipse. I've recently needed to adjust the
I've been developing my first rails application on my windows computer. But now i
I'm a newbie Cocoa developer and I'm developing my first application. I want to
Currently developing a PHP framework and have ran into my first problem. I need
First, some background: I'm developing a web application using Python. All of my (text)
I'm developing my first greasemonkey script (trying to edit and add page content to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.