Sir, I am using these codes

if(isset($_POST['update']))
    {
    // Get values from form 
    $name=$_POST['name'];
    $moba=$_POST['moba'];
    $mobb=$_POST['mobb'];
    $ptcl=$_POST['ptcl'];
    $fax =$_POST['fax'];
    $email=$_POST['email'];
    $web =$_POST['web'];
    $add =$_POST['add'];
    $city =$_POST['city'];
    $country =$_POST['country'];
    $job =$_POST['job'];
    $office =$_POST['office'];
    $place =$_POST['place'];
    $phone =$_POST['phone'];
    $others =$_POST['others'];


    if (empty($moba)){
            echo "<script>alert('No username is selected')</script>";
        }else{

$query = "UPDATE contacts SET  name=$name mobb=$mobb ptcl=$ptcl fax=$fax email=$email web=$web address=$add city=$city country=$country job=$job office=$office place=$place phone=$phone others=$others where moba='".$_POST['$moba']."'";
            $result = mysqli_query($con, $query)or die (mysqli_error());

        //check update
            if(!$result)
            {
            echo ("<script>alert('Sorry! Something went wrong.')</script>");
            }else{
            echo ("<script>alert('Record updated successfully')</script>"); 
            }
        }

but it says:

Notice: Undefined index: $moba in C:\wamp\www\Phonebook\contacts.php on line 110

and line 110 is

$query = "UPDATE contacts SET  name=$name mobb=$mobb ptcl=$ptcl fax=$fax email=$email web=$web address=$add city=$city country=$country job=$job office=$office place=$place phone=$phone others=$others where moba='".$_POST['$moba']."'";

My database is as follows:

http://i44.tinypic.com/jpzwok.jpg

What I am doing wrong?
Please help me

You query is missing comma's and single quotes. It will never run.

You should change

$_POST['$moba']

to either

$_POST['moba']

or

$moba

Thanks Sir, one problem solved, now i am facing this this problem

Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\Phonebook\contacts.php on line 111

line 111 is

$result = mysqli_query($con, $query)or die (mysqli_error());

Sir I have modified as

$result = mysqli_query($con, $query)or die (mysqli_error($con));

now it says:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mobb= ptcl= fax= email= web= address= city= country= job= office= place= phone= ' at line 1

what does it means?

You query is missing comma's and single quotes. It will never run.

Check the MySQL manual to see how an UPDATE query should be written.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.