Compare commits

...

1 Commits

Author SHA1 Message Date
Sharayu.M
f2f97e571b first commit 2024-01-31 16:52:17 +05:30
3 changed files with 39 additions and 2 deletions

@ -6,8 +6,10 @@ if (isset($_POST["submit"])) {
$last_name = $_POST['last_name']; $last_name = $_POST['last_name'];
$email = $_POST['email']; $email = $_POST['email'];
$gender = $_POST['gender']; $gender = $_POST['gender'];
$nationality = $_POST['nationality'];
$file = $_POST['file'];
$sql = "INSERT INTO `crud`(`id`, `first_name`, `last_name`, `email`, `gender`) VALUES (NULL,'$first_name','$last_name','$email','$gender')"; $sql = "INSERT INTO `crud`(`id`, `first_name`, `last_name`, `email`, `gender`, `nationality`, `file`) VALUES (NULL,'$first_name','$last_name','$email','$gender','$nationality','$file')";
$result = mysqli_query($conn, $sql); $result = mysqli_query($conn, $sql);
@ -38,6 +40,7 @@ if (isset($_POST["submit"])) {
<?php <?php
include './logo.php'; include './logo.php';
?> ?>
<nav class="navbar navbar-light justify-content-center fs-2 mb-4" style="background-color: #87CEEB;"> <nav class="navbar navbar-light justify-content-center fs-2 mb-4" style="background-color: #87CEEB;">
CRUD Application CRUD Application
</nav> </nav>
@ -77,6 +80,21 @@ if (isset($_POST["submit"])) {
<label for="female" class="form-input-label">Female</label> <label for="female" class="form-input-label">Female</label>
</div> </div>
<div class="form-group mb-3">
<label>Nationality:</label>
&nbsp;
<input type="radio" class="form-check-input" name="nationality" id="indian" value="indian">
<label for="indian" class="form-input-label">Indian</label>
&nbsp;
<input type="radio" class="form-check-input" name="nationality" id="non-indian" value="non-indian">
<label for="non-indian" class="form-input-label">Non-Indian</label>
</div>
<div class="mb-3">
<label class="form-label">Upload File:</label>
<input type="file" id="file" class="form-control" name="file" >
</div>
<div> <div>
<button type="submit" class="btn btn-dark mb-3" style="background-color: #33b5fd;" name="submit">Save</button> <button type="submit" class="btn btn-dark mb-3" style="background-color: #33b5fd;" name="submit">Save</button>
<a href="index.php" class="btn btn-dark mb-3" style="background-color: #33b5fd;">Cancel</a> <a href="index.php" class="btn btn-dark mb-3" style="background-color: #33b5fd;">Cancel</a>

@ -18,7 +18,6 @@ if (isset($_POST["submit"])) {
echo "Failed: " . mysqli_error($conn); echo "Failed: " . mysqli_error($conn);
} }
} }
?> ?>
@ -85,6 +84,21 @@ if (isset($_POST["submit"])) {
<label for="female" class="form-input-label">Female</label> <label for="female" class="form-input-label">Female</label>
</div> </div>
<div class="form-group mb-3">
<label>Nationality:</label>
&nbsp;
<input type="radio" class="form-check-input" name="nationality" id="indian" value="indian">
<label for="indian" class="form-input-label">Indian</label>
&nbsp;
<input type="radio" class="form-check-input" name="nationality" id="non-indian" value="non-indian">
<label for="non-indian" class="form-input-label">Non-Indian</label>
</div>
<div class="mb-3">
<label class="form-label">Upload File:</label>
<input type="file" id="file" class="form-control" name="file" >
</div>
<div> <div>
<button type="submit" class="btn btn-success" name="submit">Update</button> <button type="submit" class="btn btn-success" name="submit">Update</button>
<a href="index.php" class="btn btn-danger">Cancel</a> <a href="index.php" class="btn btn-danger">Cancel</a>

@ -23,6 +23,7 @@ include "db_conn.php";
<?php <?php
include './logo.php'; include './logo.php';
?> ?>
<nav class="navbar navbar-light justify-content-center fs-2 mb-4" style="background-color: #87CEEB;"> <nav class="navbar navbar-light justify-content-center fs-2 mb-4" style="background-color: #87CEEB;">
CRUD Application CRUD Application
</nav> </nav>
@ -47,6 +48,8 @@ include "db_conn.php";
<th scope="col">Last Name</th> <th scope="col">Last Name</th>
<th scope="col">Email</th> <th scope="col">Email</th>
<th scope="col">Gender</th> <th scope="col">Gender</th>
<th scope="col">Nationality</th>
<th scope="col">File</th>
<th scope="col">Action</th> <th scope="col">Action</th>
</tr> </tr>
</thead> </thead>
@ -62,6 +65,8 @@ include "db_conn.php";
<td><?php echo $row["last_name"] ?></td> <td><?php echo $row["last_name"] ?></td>
<td><?php echo $row["email"] ?></td> <td><?php echo $row["email"] ?></td>
<td><?php echo $row["gender"] ?></td> <td><?php echo $row["gender"] ?></td>
<td><?php echo $row["nationality"] ?></td>
<td><?php echo $row["file"] ?></td>
<td> <td>
<a href="edit.php?id=<?php echo $row["id"] ?>"><i class="fa-solid fa-pen-to-square fs-5 me-3" style="color:#33b5fd;"></i></a> <a href="edit.php?id=<?php echo $row["id"] ?>"><i class="fa-solid fa-pen-to-square fs-5 me-3" style="color:#33b5fd;"></i></a>
<a href="delete.php?id=<?php echo $row["id"] ?>"><i class="fa-solid fa-trash fs-5" style="color:#33b5fd;"></i></a> <a href="delete.php?id=<?php echo $row["id"] ?>"><i class="fa-solid fa-trash fs-5" style="color:#33b5fd;"></i></a>