I ve been searching through other topics to find a solution for that but nothing . I have form and i want to update the form input values when update button is clicked . The code that i using in Ajax is
$("#updateit").click(function() {
var surname = $("#search_text").val();
var name = $("#name").val();
var company_name = $("#company_name").val();
var firm = $("#firm").val();
var address = $("#address").val();
var town = $("#town").val();
var tk = $("#tk").val();
var country = $("#country").val();
var telephone = $("#telephone").val();
var fax = $("#fax").val();
var mobile = $("#mobile").val();
var web_site = $("#web_site").val();
var visitors = $("#visitors").val();
var id = $("#id").val();
$.ajax({
url: 'update1.php',
type: 'POST',
data: {surname:'surname',name:'name',company_name:'company_name',firm:'firm',address:'address',town:'town',tk:'tk',country:'country',telephone:'telephone',fax:'fax',mobile:'mobile',mail:'mail',web_site:'web_site',visitors:'visitors',id:'id'} ,
dataType:'html',
success: function(data)
{
alert(data);
}
});
});
The PHP file for updating values is this :
<?php
require('db.php');
include("auth.php");
date_default_timezone_set('Europe/Athens');
$id=$_POST['id'];
$surname =$_POST['surname'];
$name= $_POST['name'];
$company_name=$_POST['company_name'];
$firm= $_POST['firm'];
$address= $_POST['address'];
$town= $_POST['town'];
$tk= $_POST['tk'];
$country= $_POST['country'];
$telephone= $_POST['telephone'];
$fax= $_POST['fax'];
$mobile= $_POST['mobile'];
$mail= $_POST['mail'];
$web_site= $_POST['web_site'];
$visitors= $_POST['visitors'];
$update="update base set surname='".$surname."', name='".$name."',company_name='".$company_name."',firm='".$firm."',address='".$address."',town='".$town."',tk='".$tk."',country='".$country."',telephone='".$telephone."',fax='".$fax."',mobile='".$mobile."',web_site='".$web_site."',visitors='".$visitors."' where id='".$id."'";
mysql_query($update) or die(mysql_error());
$status = "Record Updated Successfully. </br></br><a href='view.php'>View Updated Record</a>";
echo '<p style="color:#FF0000;">'.$status.'</p>';
?>
Any Help appreciated