prepare( 'UPDATE leads SET Name = ?, CompanyName = ?, Email = ?, Phone = ?, PotentialAmount = ?, Status = ? WHERE LeadID = ?' ); $stmt->execute([ $name, $companyName, $email, $phone, $potentialAmount, $status, $lead_id ]); $_SESSION['success_message'] = 'Lead updated successfully!'; } catch (PDOException $e) { // In a real app, log this error. $_SESSION['error_message'] = 'Failed to update lead. Please try again.'; } header('Location: index.php'); exit();