diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..9c37599 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,83 @@ +/* General Body Styles */ +body { + background-color: #F3F4F6; + font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; + color: #1F2937; +} + +/* Main Container */ +.container { + max-width: 800px; +} + +/* Survey Card */ +.card { + background-color: #FFFFFF; + border: none; + border-radius: 0.5rem; + box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); +} + +.card-header { + background-color: #FFFFFF; + border-bottom: 1px solid #E5E7EB; + padding: 1.5rem; + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; +} + +.card-title { + color: #1F2937; + font-weight: 600; +} + +.card-body { + padding: 1.5rem; +} + +/* Form Elements */ +.form-label { + font-weight: 500; + margin-bottom: 0.5rem; +} + +.form-control, .form-check-input { + border-radius: 0.5rem; + border: 1px solid #D1D5DB; +} + +.form-control:focus, .form-check-input:focus { + border-color: #2563EB; + box-shadow: 0 0 0 0.25rem rgb(37 99 235 / 25%); +} + +.form-check-label { + margin-left: 0.5rem; +} + +/* Buttons */ +.btn-primary { + background-color: #2563EB; + border-color: #2563EB; + border-radius: 0.5rem; + padding: 0.75rem 1.5rem; + font-weight: 500; + transition: background-color 0.2s ease-in-out; +} + +.btn-primary:hover { + background-color: #1D4ED8; + border-color: #1D4ED8; +} + +/* Thank You Page */ +.thank-you-container { + text-align: center; + padding: 3rem; +} + +.thank-you-icon { + color: #14B8A6; + font-size: 4rem; + margin-bottom: 1rem; +} diff --git a/db/config.php b/db/config.php index 6a8f5d2..dde42ee 100644 --- a/db/config.php +++ b/db/config.php @@ -15,3 +15,29 @@ function db() { } return $pdo; } + +function run_migrations() { + $pdo = db(); + try { + $pdo->query("CREATE TABLE IF NOT EXISTS migrations (migration VARCHAR(255) PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"); + + $result = $pdo->query("SELECT migration FROM migrations"); + $run_migrations = $result->fetchAll(PDO::FETCH_COLUMN); + + $migration_files = glob(__DIR__ . '/migrations/*.sql'); + foreach ($migration_files as $file) { + $migration_name = basename($file); + if (!in_array($migration_name, $run_migrations)) { + $sql = file_get_contents($file); + $pdo->exec($sql); + $stmt = $pdo->prepare("INSERT INTO migrations (migration) VALUES (?)"); + $stmt->execute([$migration_name]); + } + } + } catch (PDOException $e) { + error_log('Migration failed: ' . $e->getMessage()); + // In a production environment, you might want to die() here. + } +} + +run_migrations(); diff --git a/db/migrations/001_create_responses_table.sql b/db/migrations/001_create_responses_table.sql new file mode 100644 index 0000000..66fff15 --- /dev/null +++ b/db/migrations/001_create_responses_table.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS survey_responses ( + id INT AUTO_INCREMENT PRIMARY KEY, + survey_id INT NOT NULL, + respondent_email VARCHAR(255), + question_1_answer TEXT, + question_2_answer TEXT, + question_3_answer TEXT, + submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/index.php b/index.php index 7205f3d..699c6dd 100644 --- a/index.php +++ b/index.php @@ -134,7 +134,16 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
-

Analyzing your requirements and generating your website…

+
+

Welcome to Your Survey Management System

+
+

Ready to gather insights? Create, share, and analyze surveys with ease. Get started by taking our sample survey.

+
+ Take the Sample Survey + +
+
+
Loading…
diff --git a/submit_survey.php b/submit_survey.php new file mode 100644 index 0000000..a656be9 --- /dev/null +++ b/submit_survey.php @@ -0,0 +1,45 @@ +prepare($sql); + + if ($stmt->execute([$survey_id, $email, $satisfaction, $features_str])) { + $_SESSION['success_message'] = 'Thank you for your submission!'; + header('Location: thank_you.php'); + exit; + } else { + $_SESSION['error_message'] = 'There was an error saving your response. Please try again.'; + header('Location: survey.php'); + exit; + } +} catch (PDOException $e) { + // In a real app, you would log this error, not show it to the user. + error_log('Database Error: ' . $e->getMessage()); + $_SESSION['error_message'] = 'A database error occurred. Please try again later.'; + header('Location: survey.php'); + exit; +} diff --git a/survey.php b/survey.php new file mode 100644 index 0000000..11fdea1 --- /dev/null +++ b/survey.php @@ -0,0 +1,82 @@ + + + + + + Customer Feedback Survey - Create a survey management system + + + + + + + + + + + + + + + + +
+
+
+

Customer Feedback Survey

+

Thank you for taking the time to provide your valuable feedback.

+
+
+
+ + +
+ + +
+ +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + + + diff --git a/thank_you.php b/thank_you.php new file mode 100644 index 0000000..bf5d8c4 --- /dev/null +++ b/thank_you.php @@ -0,0 +1,42 @@ + + + + + + + Thank You! - Create a survey management system + + + + + + + + + + + + + + + + + +
+
+
+ +

Thank You!

+ +

+ +

Your submission has been received.

+ + Back to Home +
+
+
+ + + +