> For the complete documentation index, see [llms.txt](https://docs.layraweb.com.tr/merhaba/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layraweb.com.tr/merhaba/php-tarafi/konular/form-islemleri/form-verilerini-isleme.md).

# Form Verilerini İşleme

PHP'de, form verilerini işlemek için bir dizi adım izlenir. Öncelikle, form verileri $\_POST veya $\_GET gibi bir süper küresel değişkende depolanır. Daha sonra, bu verilerin doğru bir şekilde işlenmesi için doğrulama, filtreleme ve veritabanı işlemleri gibi işlemler yapılır. Son olarak, kullanıcıya başarılı bir şekilde tamamlandığına dair geribildirim verilir.

İşleme adımı, verilerin doğruluğunu kontrol ederek başlar. Bu, bir formun tam olarak doldurulup doldurulmadığını, gereken alanların doldurulup doldurulmadığını veya verilerin istenen biçimde girildiğini kontrol etmek gibi birçok şeyi içerebilir. Bu işlem, verilerin filtrelenmesi ve güvenliği sağlanması için de çok önemlidir.

Ardından, form verileri işlenebilir ve sonuçlar, örneğin bir veritabanına kaydedilebilir. Bu işlem, veritabanına bağlanmayı, verileri doğru bir şekilde hazırlamayı ve sorguları yürütmeyi içerir.

Son adım, kullanıcıya işlemin başarılı bir şekilde tamamlandığına dair bir geribildirim verilmesidir. Bu geribildirim, bir teşekkür sayfası, bir e-posta veya başka bir yöntem kullanılarak sağlanabilir.

Aşağıda, bir formun işlenmesi için bir örnek verilmiştir:

{% code title="index.php" %}

```html
<form method="POST" action="process.php">
    <label for="username">Kullanıcı Adı:</label>
    <input type="text" id="username" name="username" required>

    <label for="password">Şifre:</label>
    <input type="password" id="password" name="password" required>

    <button type="submit">Gönder</button>
</form>
```

{% endcode %}

{% code title="process.php" %}

```php
// Form verilerini kontrol etme
if (!isset($_POST['username']) || empty($_POST['username']) || !isset($_POST['password']) || empty($_POST['password'])) {
    echo 'Lütfen kullanıcı adı ve şifrenizi girin.';
    exit;
}

// Form verilerini işleme
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);

// Veritabanı işlemleri
$connection = new mysqli('localhost', 'kullanici_adi', 'sifre', 'veritabani_adi');

if ($connection->connect_error) {
    die('Veritabanına bağlanılamadı: ' . $connection->connect_error);
}

$username = $connection->real_escape_string($username);
$password = $connection->real_escape_string($password);

$query = "INSERT INTO users (username, password) VALUES ('$username', '$password')";

if ($connection->query($query) === true) {
    echo 'Kullanıcı başarıyla oluşturuldu.';
} else {
    echo 'Bir hata oluştu: '
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layraweb.com.tr/merhaba/php-tarafi/konular/form-islemleri/form-verilerini-isleme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
