File size: 25,948 Bytes
0f0ad03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b46023
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f0ad03
 
 
8b46023
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f0ad03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b46023
 
 
 
 
 
 
 
 
 
 
 
 
0f0ad03
8b46023
 
 
 
 
 
 
0f0ad03
 
 
 
8b46023
 
 
 
 
 
 
0f0ad03
 
8b46023
 
 
 
 
 
 
0f0ad03
 
 
 
8b46023
 
 
 
 
 
 
0f0ad03
 
 
8b46023
 
 
 
 
 
 
0f0ad03
 
 
8b46023
 
 
0f0ad03
8b46023
 
 
 
 
 
0f0ad03
8b46023
 
 
0f0ad03
 
 
8b46023
 
 
 
 
0f0ad03
8b46023
 
 
0f0ad03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b46023
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f0ad03
8b46023
0f0ad03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MSME Connect | Empowering Small Businesses</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        /* Custom Styles */
        :root {
            --primary: #2563eb;
            --secondary: #1e40af;
            --accent: #3b82f6;
            --highlight: #93c5fd;
            --light: #f8fafc;
            --dark: #1e293b;
        }

        .bg-hero {
            background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), 
                        url('https://images.unsplash.com/photo-1556740738-b6a63e27c4df?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80');
            background-size: cover;
            background-position: center;
        }

        .service-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }

        .testimonial-card:hover {
            box-shadow: 0 8px 30px rgba(0,0,0,0.12);
        }

        .partner-logo {
            filter: grayscale(100%);
            opacity: 0.6;
            transition: all 0.3s ease;
        }

        .partner-logo:hover {
            filter: grayscale(0%);
            opacity: 1;
        }

        /* Animation */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .animate-fade-in {
            animation: fadeIn 0.8s ease-out forwards;
        }

        /* Delay animations */
        .delay-100 { animation-delay: 0.1s; }
        .delay-200 { animation-delay: 0.2s; }
        .delay-300 { animation-delay: 0.3s; }
        .delay-400 { animation-delay: 0.4s; }
        .delay-500 { animation-delay: 0.5s; }
        
        /* Form validation */
        .error {
            border-color: #ef4444 !important;
        }
        .error-message {
            color: #ef4444;
            font-size: 0.875rem;
            margin-top: 0.25rem;
        }
        .success-message {
            background-color: #10b981;
            color: white;
            padding: 1rem;
            border-radius: 0.5rem;
            margin-bottom: 1rem;
            text-align: center;
        }
    </style>
</head>
<body class="font-sans text-slate-800 bg-slate-50">
    <?php
    // Database connection
    $servername = "localhost";
    $username = "root"; // Ganti dengan username MySQL Anda
    $password = ""; // Ganti dengan password MySQL Anda
    $dbname = "msme_connect"; // Ganti dengan nama database Anda

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }

    // Initialize variables
    $business_name = $first_name = $last_name = $email = $phone = $sector = "";
    $errors = array();
    $success = false;

    // Form submission
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        // Validate and sanitize inputs
        $business_name = clean_input($_POST["business_name"]);
        if (empty($business_name)) {
            $errors["business_name"] = "Business name is required";
        }

        $first_name = clean_input($_POST["first_name"]);
        if (empty($first_name)) {
            $errors["first_name"] = "First name is required";
        }

        $last_name = clean_input($_POST["last_name"]);
        if (empty($last_name)) {
            $errors["last_name"] = "Last name is required";
        }

        $email = clean_input($_POST["email"]);
        if (empty($email)) {
            $errors["email"] = "Email is required";
        } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $errors["email"] = "Invalid email format";
        }

        $phone = clean_input($_POST["phone"]);
        if (empty($phone)) {
            $errors["phone"] = "Phone number is required";
        }

        $sector = clean_input($_POST["sector"]);
        if (empty($sector)) {
            $errors["sector"] = "Business sector is required";
        }

        $agree_terms = isset($_POST["agree_terms"]) ? 1 : 0;
        if (!$agree_terms) {
            $errors["agree_terms"] = "You must agree to the terms and conditions";
        }

        // If no errors, insert into database
        if (empty($errors)) {
            $stmt = $conn->prepare("INSERT INTO business_registrations (business_name, first_name, last_name, email, phone, sector, agree_terms) 
                                   VALUES (?, ?, ?, ?, ?, ?, ?)");
            $stmt->bind_param("ssssssi", $business_name, $first_name, $last_name, $email, $phone, $sector, $agree_terms);

            if ($stmt->execute()) {
                $success = true;
                // Reset form fields
                $business_name = $first_name = $last_name = $email = $phone = $sector = "";
            } else {
                $errors["database"] = "Error: " . $stmt->error;
            }

            $stmt->close();
        }
    }

    // Function to clean input data
    function clean_input($data) {
        $data = trim($data);
        $data = stripslashes($data);
        $data = htmlspecialchars($data);
        return $data;
    }

    // Close connection
    $conn->close();
    ?>

    <!-- Header/Navigation -->
    <header class="fixed w-full bg-white shadow-md z-50 transition-all duration-300">
        <div class="container mx-auto px-6 py-4">
            <div class="flex justify-between items-center">
                <a href="#" class="flex items-center">
                    <i class="fas fa-store text-blue-700 text-3xl mr-2"></i>
                    <span class="text-2xl font-bold text-blue-800">MSME<span class="text-blue-600">Connect</span></span>
                </a>
                
                <!-- Mobile menu button -->
                <button id="menu-toggle" class="md:hidden focus:outline-none">
                    <i class="fas fa-bars text-2xl text-blue-800"></i>
                </button>
                
                <!-- Desktop Navigation -->
                <nav class="hidden md:flex space-x-8">
                    <a href="#home" class="font-semibold text-blue-800 hover:text-blue-600 transition">Home</a>
                    <a href="#about" class="font-semibold text-slate-600 hover:text-blue-800 transition">About</a>
                    <a href="#services" class="font-semibold text-slate-600 hover:text-blue-800 transition">Services</a>
                    <a href="#benefits" class="font-semibold text-slate-600 hover:text-blue-800 transition">Benefits</a>
                    <a href="#success" class="font-semibold text-slate-600 hover:text-blue-800 transition">Success Stories</a>
                    <a href="#contact" class="font-semibold text-slate-600 hover:text-blue-800 transition">Contact</a>
                    <a href="#register" class="font-semibold bg-blue-700 text-white px-4 py-2 rounded-lg hover:bg-blue-800 transition">Register Now</a>
                </nav>
            </div>
            
            <!-- Mobile Navigation -->
            <nav id="mobile-menu" class="md:hidden hidden mt-4 space-y-3 pb-3">
                <a href="#home" class="block font-medium text-slate-700 hover:text-blue-700 transition">Home</a>
                <a href="#about" class="block font-medium text-slate-700 hover:text-blue-700 transition">About</a>
                <a href="#services" class="block font-medium text-slate-700 hover:text-blue-700 transition">Services</a>
                <a href="#benefits" class="block font-medium text-slate-700 hover:text-blue-700 transition">Benefits</a>
                <a href="#success" class="block font-medium text-slate-700 hover:text-blue-700 transition">Success Stories</a>
                <a href="#contact" class="block font-medium text-slate-700 hover:text-blue-700 transition">Contact</a>
                <a href="#register" class="block mt-2 w-full bg-blue-700 text-white font-semibold py-2 px-4 rounded-lg text-center hover:bg-blue-800 transition">Register Now</a>
            </nav>
        </div>
    </header>

    <!-- Register Section -->
    <section id="register" class="py-20 bg-blue-700 text-white">
        <div class="container mx-auto px-6">
            <div class="flex flex-col lg:flex-row items-center gap-12">
                <div class="lg:w-1/2 animate-fade-in">
                    <h2 class="text-3xl md:text-4xl font-bold mb-6">Ready to Grow Your MSME?</h2>
                    <p class="text-xl opacity-90 mb-6 leading-relaxed">
                        Join our network of successful MSMEs gaining access to financing, markets, training and support services.
                    </p>
                    <p class="text-xl opacity-90 mb-8 leading-relaxed">
                        Registration is free and takes less than 5 minutes. Let's build your business together!
                    </p>
                    
                    <div class="mb-8">
                        <h3 class="text-xl font-semibold mb-4">Who can join?</h3>
                        <div class="grid grid-cols-2 gap-4 text-white/90">
                            <div class="flex items-start">
                                <div class="flex-shrink-0 h-5 w-5 mt-1 mr-3">
                                    <i class="fas fa-check"></i>
                                </div>
                                <p>Micro enterprises (1-10 employees)</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 h-5 w-5 mt-1 mr-3">
                                    <i class="fas fa-check"></i>
                                </div>
                                <p>Small businesses (11-50 employees)</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 h-5 w-5 mt-1 mr-3">
                                    <i class="fas fa-check"></i>
                                </div>
                                <p>Medium businesses (51-250 employees)</p>
                            </div>
                            <div class="flex items-start">
                                <div class="flex-shrink-0 h-5 w-5 mt-1 mr-3">
                                    <i class="fas fa-check"></i>
                                </div>
                                <p>Startups & entrepreneurs</p>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="lg:w-1/2 bg-white rounded-xl shadow-2xl overflow-hidden animate-fade-in delay-200">
                    <div class="p-8">
                        <h3 class="text-2xl font-bold text-blue-800 mb-6">Register Your Business</h3>
                        
                        <?php if ($success): ?>
                            <div class="success-message">
                                Thank you for registering! We will contact you soon.
                            </div>
                        <?php endif; ?>
                        
                        <?php if (isset($errors['database'])): ?>
                            <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
                                <?php echo $errors['database']; ?>
                            </div>
                        <?php endif; ?>
                        
                        <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>#register" novalidate>
                            <div class="mb-4">
                                <label for="business_name" class="block text-slate-700 text-sm font-medium mb-2">Business Name *</label>
                                <input type="text" id="business_name" name="business_name" 
                                       class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['business_name']) ? 'error' : ''; ?>" 
                                       value="<?php echo htmlspecialchars($business_name); ?>">
                                <?php if (isset($errors['business_name'])): ?>
                                    <p class="error-message"><?php echo $errors['business_name']; ?></p>
                                <?php endif; ?>
                            </div>
                            
                            <div class="grid md:grid-cols-2 gap-4 mb-4">
                                <div>
                                    <label for="first_name" class="block text-slate-700 text-sm font-medium mb-2">First Name *</label>
                                    <input type="text" id="first_name" name="first_name" 
                                           class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['first_name']) ? 'error' : ''; ?>" 
                                           value="<?php echo htmlspecialchars($first_name); ?>">
                                    <?php if (isset($errors['first_name'])): ?>
                                        <p class="error-message"><?php echo $errors['first_name']; ?></p>
                                    <?php endif; ?>
                                </div>
                                <div>
                                    <label for="last_name" class="block text-slate-700 text-sm font-medium mb-2">Last Name *</label>
                                    <input type="text" id="last_name" name="last_name" 
                                           class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['last_name']) ? 'error' : ''; ?>" 
                                           value="<?php echo htmlspecialchars($last_name); ?>">
                                    <?php if (isset($errors['last_name'])): ?>
                                        <p class="error-message"><?php echo $errors['last_name']; ?></p>
                                    <?php endif; ?>
                                </div>
                            </div>
                            
                            <div class="mb-4">
                                <label for="email" class="block text-slate-700 text-sm font-medium mb-2">Email Address *</label>
                                <input type="email" id="email" name="email" 
                                       class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['email']) ? 'error' : ''; ?>" 
                                       value="<?php echo htmlspecialchars($email); ?>">
                                <?php if (isset($errors['email'])): ?>
                                    <p class="error-message"><?php echo $errors['email']; ?></p>
                                <?php endif; ?>
                            </div>
                            
                            <div class="mb-4">
                                <label for="phone" class="block text-slate-700 text-sm font-medium mb-2">Phone Number *</label>
                                <input type="tel" id="phone" name="phone" 
                                       class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['phone']) ? 'error' : ''; ?>" 
                                       value="<?php echo htmlspecialchars($phone); ?>">
                                <?php if (isset($errors['phone'])): ?>
                                    <p class="error-message"><?php echo $errors['phone']; ?></p>
                                <?php endif; ?>
                            </div>
                            
                            <div class="mb-4">
                                <label for="sector" class="block text-slate-700 text-sm font-medium mb-2">Business Sector *</label>
                                <select id="sector" name="sector" 
                                        class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition <?php echo isset($errors['sector']) ? 'error' : ''; ?>">
                                    <option value="">Select sector</option>
                                    <option value="agriculture" <?php echo ($sector == 'agriculture') ? 'selected' : ''; ?>>Agriculture</option>
                                    <option value="manufacturing" <?php echo ($sector == 'manufacturing') ? 'selected' : ''; ?>>Manufacturing</option>
                                    <option value="retail" <?php echo ($sector == 'retail') ? 'selected' : ''; ?>>Retail</option>
                                    <option value="services" <?php echo ($sector == 'services') ? 'selected' : ''; ?>>Services</option>
                                    <option value="technology" <?php echo ($sector == 'technology') ? 'selected' : ''; ?>>Technology</option>
                                    <option value="other" <?php echo ($sector == 'other') ? 'selected' : ''; ?>>Other</option>
                                </select>
                                <?php if (isset($errors['sector'])): ?>
                                    <p class="error-message"><?php echo $errors['sector']; ?></p>
                                <?php endif; ?>
                            </div>
                            
                            <div class="mb-6">
                                <label for="agree_terms" class="flex items-start">
                                    <input type="checkbox" id="agree_terms" name="agree_terms" 
                                           class="rounded text-blue-600 focus:ring-blue-500 border-slate-300 mt-1 <?php echo isset($errors['agree_terms']) ? 'error' : ''; ?>"
                                           <?php echo isset($_POST['agree_terms']) ? 'checked' : ''; ?>>
                                    <span class="ml-2 text-slate-700">I agree to the <a href="#" class="text-blue-600 hover:underline">terms and conditions</a></span>
                                </label>
                                <?php if (isset($errors['agree_terms'])): ?>
                                    <p class="error-message"><?php echo $errors['agree_terms']; ?></p>
                                <?php endif; ?>
                            </div>
                            
                            <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300 transform hover:scale-105">
                                Complete Registration
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script>
        // Mobile Menu Toggle
        document.getElementById('menu-toggle').addEventListener('click', function() {
            const menu = document.getElementById('mobile-menu');
            const icon = this.querySelector('i');
            
            // Toggle menu visibility
            menu.classList.toggle('hidden');
            
            // Change icon based on menu state
            if (menu.classList.contains('hidden')) {
                icon.classList.remove('fa-times');
                icon.classList.add('fa-bars');
            } else {
                icon.classList.remove('fa-bars');
                icon.classList.add('fa-times');
            }
        });

        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                
                const targetId = this.getAttribute('href');
                if (targetId === '#') return;
                
                const targetElement = document.querySelector(targetId);
                if (targetElement) {
                    targetElement.scrollIntoView({
                        behavior: 'smooth'
                    });
                    
                    // Close mobile menu if open
                    const mobileMenu = document.getElementById('mobile-menu');
                    if (!mobileMenu.classList.contains('hidden')) {
                        mobileMenu.classList.add('hidden');
                        document.getElementById('menu-toggle').querySelector('i').classList.remove('fa-times');
                        document.getElementById('menu-toggle').querySelector('i').classList.add('fa-bars');
                    }
                }
            });
        });

        // Header scroll effect
        window.addEventListener('scroll', function() {
            const header = document.querySelector('header');
            if (window.scrollY > 100) {
                header.classList.add('shadow-lg');
                header.classList.add('bg-white/95');
                header.classList.add('backdrop-blur-sm');
            } else {
                header.classList.remove('shadow-lg');
                header.classList.remove('bg-white/95');
                header.classList.remove('backdrop-blur-sm');
            }
        });

        // Animation observer
        const animateElements = document.querySelectorAll('.animate-fade-in');
        
        const observer = new IntersectionObserver((entries) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    entry.target.style.opacity = 1;
                    entry.target.style.transform = 'translateY(0)';
                }
            });
        }, { 
            threshold: 0.1 
        });

        animateElements.forEach(element => {
            element.style.opacity = 0;
            element.style.transform = 'translateY(20px)';
            element.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
            observer.observe(element);
        });

        // Client-side validation
        document.querySelector('form').addEventListener('submit', function(e) {
            let isValid = true;
            const form = e.target;

            // Clear previous error states
            document.querySelectorAll('.error').forEach(el => {
                el.classList.remove('error');
            });
            document.querySelectorAll('.error-message').forEach(el => {
                el.style.display = 'none';
            });

            // Validate required fields
            const requiredFields = [
                'business_name', 
                'first_name', 
                'last_name', 
                'email', 
                'phone', 
                'sector',
                'agree_terms'
            ];

            requiredFields.forEach(fieldId => {
                const field = form[fieldId];
                if (field) {
                    if (field.type === 'checkbox') {
                        if (!field.checked) {
                            isValid = false;
                            const label = field.closest('label');
                            if (label) {
                                label.classList.add('error');
                            }
                            // Show error message
                            const errorElement = document.createElement('p');
                            errorElement.className = 'error-message';
                            errorElement.textContent = 'You must agree to the terms and conditions';
                            label.after(errorElement);
                        }
                    } else if (!field.value.trim()) {
                        isValid = false;
                        field.classList.add('error');
                        // Show error message
                        const errorElement = document.createElement('p');
                        errorElement.className = 'error-message';
                        errorElement.textContent = 'This field is required';
                        field.after(errorElement);
                    }
                }
            });

            // Validate email format
            const emailField = form['email'];
            if (emailField && emailField.value.trim()) {
                const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
                if (!emailRegex.test(emailField.value.trim())) {
                    isValid = false;
                    emailField.classList.add('error');
                    // Show error message
                    const errorElement = document.createElement('p');
                    errorElement.className = 'error-message';
                    errorElement.textContent = 'Please enter a valid email address';
                    emailField.after(errorElement);
                }
            }

            if (!isValid) {
                e.preventDefault();
                // Scroll to first error
                const firstError = document.querySelector('.error');
                if (firstError) {
                    firstError.scrollIntoView({
                        behavior: 'smooth',
                        block: 'center'
                    });
                }
            }
        });
    </script>
</body>
</html>