Hi again ,
Im trying to create form which allows the users to edit their data , I've created the form ,added the sql i think is right but its not working and giving me sql erro that the data can't be inserted . this is my code for the form details.php :
<?php include '../header.php';
include '../config2.php';
session_start();
$id = $_POST['ID'];
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/parsley.js"></script>
<script>
$(document).ready(function() {
// submit data on click and check if valid
$('#sendData').click(function(e) {
//check if valid with parsley
var valid = $('#detailform').parsley ( 'validate' );
if ( valid === false )
{
e.preventDefault();
}
else
{
$.post("updateprocess.php", $("#detailform").serialize());
}
});
});
</script>
<div id="title">
<div class="inner">
<h1>Changing Your Account Details</h1>
</div>
</div>
<div id="content" class="right-sidebar">
<div class="container inner">
<div id="main" role="main">
<div class="container">
<h3>Please Choose Which information Your would like to change</h3>
<form data-validate="parsley" method="POST" action="updateprocess.php" id="detailform" >
<label>Email Address</label>
<input type="text" name="login_email" data-required="true" value="<?php echo $account['login_email']; ?>"/>
<label>Change a password</label>
<input type="password" name="login_password" data-notblank="true"/>
<label>Re-enter new password</label>
<input type="password" name="confirm" data-notblank="true"/>
<label>First Name</label>
<input type="text" name="first_name" data-required="true" value="<?php echo $account['first_name']; ?>" disabled="disabled" />
<label>Last Name</label>
<input type="text" name="last_name" data-notblank="true" />
<label>Address line 1</label>
<input type="text" name="address_one" data-required="true" value="<?php echo $account['address_one']; ?>"/>
<label>Address line 2</label>
<input type="text" name="address_two" data-required="true" value="<?php echo $account['address_two']; ?>"/>
<label>Town/City</label>
<input type="text" name="town_city" data-required="true" value="<?php echo $account['town_city']; ?>" />
<label>County</label>
<input type="text" name="county_option" data-required="true" value="<?php echo $account['county_option']; ?>"/>
<label>Postcode</label>
<input type="text" name="post_code" data-required="true" value="<?php echo $account['post_code']; ?>"/>
<label>Phone number</label>
<input type="text" name="phone_number" data-required="true" value="<?php echo $account['phone_number']; ?>"/>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<input type="checkbox" class="checkbox" id="agree" name="agree" /> I Agree With Terms & Conditions</p>
<td> <input type="submit" name="submit" class="button" value= "Save"/></td>
</form>
</div>
<div class="space"></div>
</div>
<ul class="sidebar" role="complementary">
<li>
<h2>Navigation</h2>
<ul class="link-list">
<li><a href="/account/dashboard.php">Dashboard</a></li>
<li><a href="/account/transfer.php">Transfer Money</a></li>
<li><a href="/account/transactions.php">Transactions</a></li>
<li><a href="/account/withdrawal.php">Withdraw Funds</a></li>
<li><a href="/account/upload.php">Upload Funds</a></li>
<li><a href="/account/details.php">Change My details</a></li>
</ul>
</li>
</ul>
</div>
</div>
<?php include '../footer.php'; ?>
this is the update.php script
<?php
include "config2.php";
$id = $_POST['ID'];
$sql="SELECT * FROM users WHERE id='$id'";
$result=mysql_query($sql);
$id = $_POST['ID'];
$rows=mysql_fetch_array($result);
$email = $_POST['login_email'];
$pass = md5($_POST['login_password']);
$confirm = md5($_POST['confirm']);
$fname = $_POST['first_name'];
$lname = $_POST['last_name'];
$addressone = $_POST['address_one'];
$addresstwo = $_POST['address_two'];
$towncity = $_POST['town_city'];
$countyoption = $_POST['county_option'];
$postcode = $_POST['post_code'];
$phone = $_POST['phone_number'];
$update = 'UPDATE users SET( login_email, login_password, confirm, first_name, last_name, address_one, address_two, town_city, county_option, post_code, phone_number) VALUES("'.$email.'","'.$pass.'","'.$confirm.'","'.$fname.'","'.$lname.'","'.$addressone.'","'.$addresstwo.'","'.$towncity.'","'.$countyoption.'","'.$postcode.'","'.$phone.'")WHERE id="'.$id.'""';
//$insert = 'UPDATE users SET login_email="'.$email.'", login_password="'.$pass.'", confirm="'.$confirm.'", first_name="'.$fname.'", last_name="'.$lname.'", address_one="'.$addressone.'", address_two="'.$addresstwo.'", town_city="'.$towncity.'", county_option="'.$countyoption.'", post_code="'.$postcode.'", phone_number="'.$phone.'" WHERE id="'.$id.'""';
mysql_query($update) or die("Failed Updating Your Data,check SQL");
header( 'Location: ../account/success.php' ) ;
?>