Untitled

mail@pastecode.io avatar
unknown
php
a month ago
4.1 kB
7
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nelu Garila</title>
    <style>
        
        body {
            font-family: Arial, sans-serif;
            background-color: #e3fcec;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        
        form {
            background-color: #ffffff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: 300px;
        }

        
        label {
            font-weight: bold;
            color: #2d572c; 
        }

        
        input[type="text"],
        input[type="email"],
        input[type="number"],
        textarea,
        select {
            width: 100%;
            padding: 10px;
            margin: 5px 0 15px 0;
            border: 1px solid #cccccc;
            border-radius: 5px;
            box-sizing: border-box;
            transition: 0.3s;
        }

        
        input[type="text"]:focus,
        input[type="email"]:focus,
        input[type="number"]:focus,
        textarea:focus,
        select:focus {
            border-color: #64d77b;
            box-shadow: 0 0 8px #64d77b;
        }

        
        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            width: 100%;
            font-size: 16px;
            transition: 0.3s;
        }

        

        input[type="submit"]:hover {
            background-color: #45a049; 
        }

        input[type="radio"] {
            margin-right: 10px;
        }

        form p {
            color: green;
            font-weight: bold;
            text-align: center;
        }
    </style>
</head>
<body>

    <form method="POST" action="index.php">
        <label for="name">Nume:</label>
        <input type="text" id="name" name="name" required>

        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required>

        <label for="gender">Gen:</label><br>
        <input type="radio" id="male" name="gender" value="Masculin" required>
        <label for="male">Masculin</label><br>
        <input type="radio" id="female" name="gender" value="Feminin" required>
        <label for="female">Feminin</label><br><br>

        <label for="comments">Comentarii:</label>
        <textarea id="comments" name="comments" rows="4" cols="50"></textarea>

        <label for="age">Vârstă:</label>
        <input type="number" id="age" name="age" min="1" max="120" required>

        <label for="country">Țara:</label>
        <select id="country" name="country" required>
            <option value="Moldova">Moldova</option>
            <option value="Romania">Romania</option>
            <option value="Romania">Ukraina</option>
            <option value="Altele">Altele</option>
        </select>

        <input type="submit" value="Trimite">
    </form>

    <?php
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        // Preluarea datelor din formular
        $name = htmlspecialchars($_POST['name']);
        $email = htmlspecialchars($_POST['email']);
        $gender = htmlspecialchars($_POST['gender']);
        $comments = htmlspecialchars($_POST['comments']);
        $age = htmlspecialchars($_POST['age']);
        $country = htmlspecialchars($_POST['country']);


        $formData = "Nume: $name\nEmail: $email\nGen: $gender\nComentarii: $comments\nVârstă: $age\nȚara: $country\n\n";

        
        file_put_contents('form.txt', $formData, FILE_APPEND);
    
        echo "<p>Datele au fost trimise cu succes și stocate în fișier!</p>";
    
    
    }
    
    
        
   
    
    

    ?>
</body>
</html>
Leave a Comment