34702-vm/request_form.php
2025-10-05 21:53:53 +00:00

76 lines
3.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once 'header.php';
require_once 'db/config.php';
$influencer_id = $_GET['influencer_id'] ?? null;
$message = '';
if (!$influencer_id) {
die("Influencer bulunamadı.");
}
// Fetch influencer details to display
$pdo = db();
$stmt = $pdo->prepare("SELECT name, surname FROM users WHERE id = ? AND role = 'talent'");
$stmt->execute([$influencer_id]);
$influencer = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$influencer) {
die("Belirtilen influencer bulunamadı veya bir yetenek değil.");
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$client_name = $_POST['client_name'] ?? '';
$client_surname = $_POST['client_surname'] ?? '';
$client_phone = $_POST['client_phone'] ?? '';
$request_message = $_POST['message'] ?? '';
if ($client_name && $client_surname && $client_phone) {
try {
$insert_stmt = $pdo->prepare("
INSERT INTO influencer_requests
(influencer_user_id, client_name, client_surname, client_phone, message)
VALUES (?, ?, ?, ?, ?)
");
$insert_stmt->execute([$influencer_id, $client_name, $client_surname, $client_phone, $request_message]);
$message = '<div class="alert alert-success">Talebiniz başarıyla gönderildi.</div>';
} catch (PDOException $e) {
$message = '<div class="alert alert-danger">Talebiniz gönderilirken bir hata oluştu: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-danger">Lütfen tüm zorunlu alanları doldurun.</div>';
}
}
?>
<div class="container mt-5">
<h1 class="mb-4">Influencer için Talep Oluştur</h1>
<p><strong>Influencer:</strong> <?php echo htmlspecialchars($influencer['name'] . ' ' . $influencer['surname']); ?></p>
<?php echo $message; ?>
<form action="" method="POST">
<input type="hidden" name="influencer_id" value="<?php echo htmlspecialchars($influencer_id); ?>">
<div class="mb-3">
<label for="client_name" class="form-label">Adınız</label>
<input type="text" class="form-control" id="client_name" name="client_name" required>
</div>
<div class="mb-3">
<label for="client_surname" class="form-label">Soyadınız</label>
<input type="text" class="form-control" id="client_surname" name="client_surname" required>
</div>
<div class="mb-3">
<label for="client_phone" class="form-label">Telefon Numaranız</label>
<input type="tel" class="form-control" id="client_phone" name="client_phone" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Mesajınız</label>
<textarea class="form-control" id="message" name="message" rows="4"></textarea>
</div>
<button type="submit" class="btn btn-primary">Talebi Gönder</button>
<a href="influencers.php" class="btn btn-secondary">Geri Dön</a>
</form>
</div>
<?php require_once 'footer.php'; ?>