SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Creating A Page To Edit Information And Update The Information On The Database

    I recently (with some help from some good guys) created a page which displays the data in my sql database, in table form. I then designed it so that when you click on the users name in the table it will go to a view.php page, which shows further details of the user in question.

    this is the code once we've gone into the view.php:

    PHP Code:
    <?php
                
    if(isset($_REQUEST['id']))
                {
                
    $user_id $_REQUEST['id'];
                
                
    $conn mysql_connect("localhost","root","") or die("Could Not 

    Connect To The Database"
    ); 
            
    mysql_select_db("aziz",$conn) or die("Could Not Select The Database"); 
                
                
    //sql query somethinglike
                
                
    $sql "SELECT * FROM azizpassword WHERE user_id = '".$user_id."'"
                
    $result mysql_query($sql); 
                
    $row mysql_fetch_assoc($result); 
                
            echo 
    "<h1>"."Name:" " " $row['az_firstname'] . " " $row['az_surname'

    "</h1>"
            echo 
    "<h4>"."Username:" " " $row['username'] . " " "</h4>";
            echo 
    "<h4>"."User ID:" " " $row['user_id'] . " " "</h4>";
            echo 
    "<h4>"."Password:"." " $row['password']. "</h4>";
            echo 
    '<br> ';
            echo 
    '<br> ';
            if (isset(
    $HTTP_REFERER)) {echo "<a href='$HTTP_REFERER'>BACK</a>"; } 
            else {echo 
    "<a href='javascript:history.back()'>BACK</a>"
            }
                  
                
                }
                
    ?>
    What I need to do is to do is allow the information shown on view.php of the selected username to be allowed to be edited and then allowed to be updated on it's correct place on the database. Making sure that the data updated is the data chosen and shown on view.php.So I was wondering if anyone had any ways or suggestions in which to bring the data shown back in text boxes, so that i can update the table by typing, deleting and modifying, basically editing the information and then there will be a submit button which then clicking on the submit button it will update the information about that chosen user only on my sql database.

    I hope someone can help me with this problem that would be great

    Thank You really appreciate it

    Take Care

  2. #2
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    see if you can expand/ use this tutorial i wrote...it gives you the basic idea

    http://www.php-for-beginners.co.uk/page/57


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •