i need some one to help me with the php codes to extract user data/informatio and then edit /update the information. using php and mysql.

Recommended Answers

All 2 Replies

Please post your code and say where you're having problems.

Here is some help to get you started, its not working code, just a rough outline to get you started. it's simple and basic, but this is how I create simple CRUD forms.

//Connect to db

//Select DB

//Catch Post Data and Process
    $profile_id = $_POST['pid'];
    $username = $_POST['username'];
    $fullname = $_POST['fullname'];
    $profile  = $_POST['profile'];

    //Check if content is present
    if(!empty($username)  && !empty($fullname) && !empty($profile)){

        //Update DB
        $q = mysql_query("UPDATE tablename SET username='$username', fullname='$fullname', profile='$profile' WHERE id='$profile_id' LIMIT 1");
        //Create Debug Message
            die("Failed to update database check query string or input values.", mysql_error());
        //If query is good, head back to desired page.
        header("Location: /");
        //Create Empty Error Message
        $error = "Error! No Changes Made";

//Create edit form
<form action="" method="POST">
    //Check if has errors
    <?php if(isset($error) != NULL):?>
        <p><?php echo $error; ?></p>
    <?php endif; ?>

    //Create dropdown menu of username with profile id's as values.
    <select name="pid">
        <option value="$profile_id">User1</option>
        <option value="$profile_id">User2</option>
        <option value="$profile_id">User3</option>
    <input type="text" name="username" />
    <input type="text" name="fullname" />
    <textarea name="profile" ></textarea>
    <button type="submit" name="edit">Edit User</button>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.