Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
7.9 kB
4
Indexable
Never
<?php
$server_name = "orlei.mtacloud.co.il";
$user_name = "orlei_SOY";
$password = "D(3I}jl{{fa#";
$database_name = "orlei_form_101";

// Create connection
$conn = mysqli_connect($server_name, $user_name, $password, $database_name);

// Check the connection
if (mysqli_connect_error()) {
    die("Connection failed: " . mysqli_connect_error());
}

// Add user
if (isset($_POST["submit"])) {
    // Get info from HTML
    $firstName = $_POST['firstName'];
    $lastName = $_POST['lastName'];
    $id = $_POST['id'];
    $dateOfBirth = $_POST['dateOfBirth'];
    $city = $_POST['city'];
    $email = $_POST['email'];
    $maritalStatus = $_POST['maritalStatus'];
    $healthFund = $_POST['healthFund'];

    // Use prepared statements to prevent SQL injection
    $stmt = $conn->prepare("INSERT INTO employee (firstName, lastName, id, dateOfBirth, city, email, maritalStatus, healthFund) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
    $stmt->bind_param("ssssssss", $firstName, $lastName, $id, $dateOfBirth, $city, $email, $maritalStatus, $healthFund);
    
    if ($stmt->execute()) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $stmt->error;
    }
    
    $stmt->close();
}

$conn->close();
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>טופס 101 המכללה האקדמית</h1>
<p class="color-red">שדות נדרשים מסומנים בכוכבית *</p>
<form action="" method="POST" onreset="setCurrentYear()">
    <div class="form-input-flx">
        <div class="blk-brdr">
            <label for="taxYear" class="form-label">
                שנת מס
            </label>
            <input type="text" disabled name="taxYear" id="taxYear" on="setCurrentYear()"/>
        </div>

        <h2 class="blk-brdr">פרטי המעסיק</h2>

        <section class="blk-brdr">
            <div class="inline-flx">
                <div class="inline-flx">
                    <label for="name" class="form-label">שם</label>
                    <input type="text" placeholder="המכללה האקדמית" name="name" id="name" class="form-input"/>
                </div>

                <div class="inline-flx">
                    <label for="address" class="form-label">כתובת</label>
                    <input type="text" placeholder="רבנו ירוחם 2" name="address" id="address"
                           class="form-input"/>
                </div>

                <div class="inline-flx">
                    <label for="telNumber" class="form-label">מספר טלפון</label>
                    <input type="tel" placeholder="03-9999999" name="telNumber" id="telNumber"
                           class="form-input"/>
                </div>

                <div class="inline-flx">
                    <label for="deductionsPortfolio" class="form-label">תיק ניכויים</label>
                    <input type="number" placeholder="000000000" name="deductionsPortfolio" id="deductionsPortfolio"
                           class="form-input"/>
                </div>
            </div>
        </section>
    </div>

    <h2 class="blk-brdr">פרטי העובד</h2>

    <section class="blk-brdr">
        <div class="inline-flx">
            <div class="inline-flx">
                <label for="firstName" class="form-label">שם פרטי</label>
                <span class="color-red">*</span>
                <input type="text" required name="firstName" id="firstName"
                       class="form-input"/>
            </div>

            <div class="inline-flx">
                <label for="lastName" class="form-label">שם משפחה</label>
                <span class="color-red">*</span>
                <input type="text" required name="lastName" id="lastName"
                       class="form-input"/>
            </div>
        </div>
    </section>

    <p>זיהוי על פי *</p>
    <div class="brd-gray">
        <input type="radio" name="radio" value="id" id="id1" class="form-input" checked/>
        <label>תעודת זהות</label>

        <input type="radio" name="radio" value="passport" id="passport" class="form-input"/>
        <label>דרכון (עבור אזרח זר)</label>
    </div>

    <div class="block blk-brdr">
        <div class="inline-flx pad-l-8">
            <label for="id" class="form-label">מספר זהות</label>
            <input type="text" name="id" id="id" class="form-input"/>
        </div>

        <div class="inline-flx">
            <label for="idImage" class="form-label">צילום תעודת זהות</label>
            <input type="file" name="idImage" id="idImage" class="form-input"/>
        </div>
    </div>

    <div class="block blk-brdr">
        <div class="inline-flx pad-l-8">
            <label for="dateOfBirth" class="form-label">תאריך לידה</label>
            <span class="color-red">*</span>
            <input type="date" required name="dateOfBirth" id="dateOfBirth" class="form-input"/>
        </div>

        <div class="inline-flx">
            <label for="dateOfImigration" class="form-label">תאריך עלייה</label>
            <input type="date" name="dateOfImigration" id="dateOfImigration" class="form-input"/>
        </div>
    </div>

    <div class="block blk-brdr">
        <div class="inline-flx pad-l-8">
            <label for="city" class="form-label">יישוב</label>
            <select name="city" id="city">
                <option value="ramatGan">רמת גן</option>
                <option value="petahTikva">פתח תקווה</option>
                <option value="telAviv">תל אביב</option>
                <option value="haifa">חיפה</option>
                <option value="eilat">אילת</option>
            </select>
        </div>

        <div class="inline-flx pad-l-8">
            <label for="street" class="form-label">רחוב</label>
            <select name="street" id="street">
                <option value="hever">חבר</option>
                <option value="hrgaman">ארגמן</option>
                <option value="daniel">דניאל</option>
                <option value="rabin">רבין</option>
                <option value="einstein">איינשטיין</option>
            </select>
        </div>

        <div class="inline-flx">
            <label for="houseNum" class="form-label">מספר בית</label>
            <span class="color-red">*</span>
            <input type="number" required name="houseNum" id="houseNum" class="form-input"/>
        </div>

        <div class="inline-flx">
            <label for="postalCode" class="form-label">מיקוד</label>
            <span class="color-red">*</span>
            <input type="number" required name="postalCode" id="postalCode" class="form-input"/>
        </div>
    </div>

    <div class="block blk-brdr">
        <div class="inline-flx pad-l-8">
            <label for="eePhoneNum" class="form-label">מספר טלפון נייד</label>
            <span class="color-red">*</span>
            <input type="tel" required name="eePhoneNum" id="eePhoneNum" class="form-input"/>
        </div>

        <div class="inline-flx">
            <label for="eeTelNum" class="form-label">מספר טלפון</label>
            <input type="tel" name="eeTelNum" id="eeTelNum" class="form-input"/>
        </div>
    </div>

    <div class="block blk-brdr">
        <div class="inline-flx pad-l-8">
            <label for="email" class="form-label">כתובת דואר אלקטרוני</label>
            <span class="color-red">*</span>
            <input type="email" required name="email" id="email" class="
Leave a Comment