Location: PHPKode > scripts > Addressbook > addressbook/update-profile.php
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
include_once("functions.php");
include_once("config.php");
include_once("open-db.php"); 
    # processed when form is submitted back onto itself
if ( isset($id) ) {	
    if (isset($_POST["save"])) {
	
// add an if save or else profile=old information.	
	include_once("upload-file.php");
		$profileimg = $randName . '.' . $ext;
	
	$id = $_REQUEST["id"];
		
 	$sql = "UPDATE addressbook SET
		profile='$profileimg'
  		WHERE id=$id";
		 
        # execute SQL statement
        mysql_query($sql);

        # check for errors
        if (mysql_error()) { print "Database Error: $sql " . mysql_error(); }

        print "<form method=\"post\"><fieldset><p><b>Updated</b></p>\n<input name='button' type='button' tabindex='1' id='fclose' onclick='window.close()' value='Close' /><fieldset></form>\n";
    }
    else { # display edit form (not post method)

        # setup SQL statement to retrieve link that we want to edit
		$sql  = " SELECT * FROM addressbook ";
        $sql .= " WHERE id = $id ";
		
        # execute SQL statement
        $result = mysql_query($sql,$cid);

        # retrieve values
        $row = mysql_fetch_array($result);
			include("rows.php"); 
	
?>
<form name="add" method="post" action="<? echo"update-profile.php?id=$id";?>" enctype="multipart/form-data">
  <fieldset>
  Update Photo:<br>
  <input type="file" name="profile" tabindex="19"  size="20">
  
  <dl>Images must be in JPG format.<br />
  <input type="submit" name="save" value="Save" id="fsave" class="button" tabindex="20" />
    <input name="button" type="button" tabindex="21" id="fcancel" onClick="window.close()" value="Cancel" />
  </dl>
  </fieldset>
</form>
<?  } }?>
Return current item: Addressbook