Congressional Member Search

<?php
// Get unique values from database for dropdowns
$host = 'localhost';
$database = 'u135121831_TRC2';
$username = 'u135121831_RobbieTRC2';
$password = 'Robbie09876';

$states = [];
$parties = [];
try {
    $conn = mysqli_connect($host, $username, $password, $database);
    if ($conn) {
        // Get unique states
        $state_query = mysqli_query($conn, "SELECT DISTINCT state FROM congress_members ORDER BY state");
        while ($row = mysqli_fetch_assoc($state_query)) {
            $states[] = $row['state'];
        }
        
        // Get unique parties
        $party_query = mysqli_query($conn, "SELECT DISTINCT party FROM congress_members ORDER BY party");
        while ($row = mysqli_fetch_assoc($party_query)) {
            $parties[] = $row['party'];
        }
        
        mysqli_close($conn);
    }
} catch (Exception $e) {
    // Silently fail - form will still work
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Resistance Club - Congressional Member Search</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            min-height: 100vh;
            padding: 20px;
            color: #000 !important;
        }
        
        .container {
            max-width: 900px;
            margin: 0 auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            overflow: hidden;
        }
        
        .header {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }
        
        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }
        
        .header p {
            font-size: 1.2em;
            opacity: 0.9;
        }
        
        .search-form {
            padding: 40px;
            color: #000 !important;
        }
        
        .search-form * {
            color: #000 !important;
        }
        
        .search-form .header,
        .search-form .header * {
            color: white !important;
        }
        
        .search-section {
            margin-bottom: 30px;
        }
        
        .search-section h2 {
            color: #1e3c72;
            margin-bottom: 15px;
            font-size: 1.4em;
            border-bottom: 2px solid #1e3c72;
            padding-bottom: 10px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #000;
        }
        
        input[type="text"],
        select {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 6px;
            font-size: 16px;
            transition: border-color 0.3s;
        }
        
        input:focus,
        select:focus {
            outline: none;
            border-color: #1e3c72;
        }
        
        .two-column {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        .search-tips {
            background: #e3f2fd;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 30px;
            border-left: 4px solid #1e3c72;
        }
        
        .search-tips h3 {
            color: #1e3c72;
            margin-bottom: 10px;
        }
        
        .search-tips ul {
            margin-left: 20px;
            color: #000;
        }
        
        .search-tips li {
            margin-bottom: 5px;
            color: #000;
        }
        
        .button-group {
            display: flex;
            gap: 15px;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .btn-search {
            flex: 1;
            min-width: 200px;
            padding: 15px 30px;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .btn-search:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(30, 60, 114, 0.3);
        }
        
        .btn-reset {
            padding: 15px 30px;
            background: #6c757d;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .btn-reset:hover {
            background: #5a6268;
        }
        
        @media (max-width: 768px) {
            .two-column {
                grid-template-columns: 1fr;
            }
            
            .button-group {
                flex-direction: column;
            }
            
            .btn-search {
                min-width: auto;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🏛️ Congressional Member Search</h1>
            <p>Track Your Representatives & Senators</p>
        </div>
        
        <form class="search-form" action="/member-results.php" method="GET">
            
            <div class="search-tips">
                <h3>🔍 Search Tips</h3>
                <ul>
                    <li>Leave all fields blank to see all members</li>
                    <li>Search by name to find specific legislators</li>
                    <li>Filter by state to see your delegation</li>
                    <li>Use party filter to track Democrats, Republicans, or Independents</li>
                </ul>
            </div>
            
            <div class="search-section">
                <h2>Search by Name</h2>
                <div class="form-group">
                    <label for="name">Member Name</label>
                    <input type="text" id="name" name="name" placeholder="e.g., Schumer, Pelosi, Sanders...">
                </div>
            </div>
            
            <div class="search-section">
                <h2>Filter by Location</h2>
                <div class="two-column">
                    <div class="form-group">
                        <label for="state">State</label>
                        <select id="state" name="state">
                            <option value="">All States</option>
                            <?php foreach ($states as $state_code): ?>
                                <option value="<?php echo htmlspecialchars($state_code); ?>">
                                    <?php echo htmlspecialchars($state_code); ?>
                                </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                    
                    <div class="form-group">
                        <label for="chamber">Chamber</label>
                        <select id="chamber" name="chamber">
                            <option value="">Both Chambers</option>
                            <option value="Senate">Senate</option>
                            <option value="House">House of Representatives</option>
                        </select>
                    </div>
                </div>
            </div>
            
            <div class="search-section">
                <h2>Filter by Party</h2>
                <div class="form-group">
                    <label for="party">Political Party</label>
                    <select id="party" name="party">
                        <option value="">All Parties</option>
                        <?php foreach ($parties as $party_name): ?>
                            <option value="<?php echo htmlspecialchars($party_name); ?>">
                                <?php echo htmlspecialchars($party_name); ?>
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>
            
            <div class="button-group">
                <a href="https://theresistance.club/casa" class="btn-reset" style="text-decoration: none; text-align: center; display: flex; align-items: center; justify-content: center;">🏠 Home</a>
                <button type="submit" class="btn-search">🔍 Search Members</button>
                <button type="reset" class="btn-reset">Clear Form</button>
            </div>
        </form>
    </div>
</body>
</html>
Scroll to Top