Code: Select all
$connection = mysql_connect("*******","*****","*****");
if ($connection) {
mysql_select_db("*******", $connection);
$email = $_SESSION["email"];
$pass = $_GET["password"];
$fname = $_GET["first"];
$lname = $_GET["last"];
$add = $_GET["address"];
$zip = $_GET["zip"];
mysql_query("UPDATE accounts SET password='$pass', first='$first', last='$last', address='$address', zip='$zip' WHERE email='$email'");
}Code: Select all
function SaveAccount() {
password = document.getElementById("edit_pswrd").value;
first = document.getElementById("edit_fname").value;
last = document.getElementById("edit_lname").value;
address = document.getElementById("edit_address").value;
zip = document.getElementById("edit_zipcode").value
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","../php/saveaccount.php?password=" + password + "&first=" + first + "&last=" + last + "&address=" + address + "&zip=" + zip,true);
xmlhttp.send();
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("passwordfield").innerHTML= password;
document.getElementById("fnamefield").innerHTML= first;
document.getElementById("lnamefield").innerHTML= last;
document.getElementById("addressfield").innerHTML= address;
document.getElementById("zipcodefield").innerHTML= zip;
} }
editting = false;
document.getElementById("editlink").innerHTML = "Edit";
}