hello. i have a contact page that has a table populated by data from database. when a user clicks on a name a popup appears with that names data so user can edit/update. in that popup there is one drop down named salutations. say that drop down is not edited but only house address is updated when button update is clicked i get notice/warning:

Notice: Undefined index: salutations in C:\Xampp\htdocs\EMS2\updateContact.php on line 5

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\Xampp\htdocs\EMS2\updateContact.php on line 27

php:

<?php
if(isset($_POST['updateC']))
{
    require "connection.php";
    $salutations = $_POST['salutations'];
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
    $line1 = $_POST['line1'];
    $email = $_POST['email'];
    $mobile = $_POST['mobile'];
    $off = $_POST['office'];
    $day = $_POST['dob'];
    $id = $_POST['contactid'];

    $updatec = $dbh->prepare("UPDATE contact1 SET salutation = :salutations, fname = :fname, lname = :lname, day = :day, month = :month, year = :year, house = :line1, mobile = :mobile, office = :office, email = :email WHERE contact_id = :id ");
    $updatec->bindParam(':salutatuions', $salutations);
    $updatec->bindParam(':fname', $fname);
    $updatec->bindParam(':lname', $lname);
    $updatec->bindParam(':day', $day);
    $updatec->bindParam(':month', $month);
    $updatec->bindParam(':year', $year);
    $updatec->bindParam(':line1', $line1);
    $updatec->bindParam(':mobile', $mobile);
    $updatec->bindParam(':office', $off);
    $updatec->bindParam(':email', $email);
    $updatec->bindParam(':id', $id);
    if($updatec->execute())
    {
        echo '<script type="text/javascript">window.location.href="contact_data.php"</script>';
    }
}
?>

how do i get pass this?

print screen page:
58efe7e840a0d47857a4c1a655bec79c

Recommended Answers

All 2 Replies

oh thanks for that. but i still get a notice for the dropdown.

Notice: Undefined index: salutations in C:\Xampp\htdocs\EMS2\updateContact.php on line 5

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.