Skip to content

Commit

Permalink
Update FR Website
Browse files Browse the repository at this point in the history
  • Loading branch information
“Muhammad committed Oct 13, 2024
1 parent f187819 commit 50aefbe
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 1 deletion.
75 changes: 74 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
</button>
</li>



<!-- <li class="nav_list">
<a href="#contact" class="nav-link">Contact</a>
<div class="circle"></div>
Expand Down Expand Up @@ -349,7 +351,7 @@ <h2>Find Me <i class="uil uil-corner-right-down"></i></h2>

</style>

<div class="form-control">
<!-- <div class="form-control">
<form action="https://forms.gle/y8rwgGpwayBnQxWp7" method="POST">
<div class="form-inputs">
<input type="text" name="entry.123456789" class="input-field" placeholder="Name">
Expand All @@ -363,8 +365,79 @@ <h2>Find Me <i class="uil uil-corner-right-down"></i></h2>
</div>
</form>
</div> -->


<!-- <div class="form-control">
<form action="https://docs.google.com/forms/d/e/1FAIpQLSckH2y2g84jFU-eCMndRnkcCxqHitQFe4d0mW1_00rHxQdv3w/viewform?usp=sf_link" method="POST" target="_blank" onsubmit="return validateForm()">
<div class="form-inputs">
<input type="text" id="name" name="entry.2005620554" class="input-field" placeholder="Name" required>
<input type="email" id="email" name="entry.1045781291" class="input-field" placeholder="Email" required>
</div>
<div class="text-area">
<textarea id="message" name="entry.839337160" placeholder="Message" required></textarea>
</div>
<div class="form-button">
<button type="submit" class="btn">Send <i class="uil uil-message"></i></button>
</div>
</form>
</div> -->


<!-- <div class="form-control">
<form action="https://docs.google.com/forms/d/e/1FAIpQLSckH2y2g84jFU-eCMndRnkcCxqHitQFe4d0mW1_00rHxQdv3w/viewform?usp=sf_link" method="POST" onsubmit="return validateForm()">
<div class="form-inputs">
<input type="text" id="name" name="name" class="input-field" placeholder="Name" required>
<input type="email" id="email" name="email" class="input-field" placeholder="Email" required>
</div>
<div class="text-area">
<textarea id="message" name="message" placeholder="Message" required></textarea>
</div>
<div class="form-button">
<button type="submit" class="btn">Send <i class="uil uil-message"></i></button>
</div>
</form>
</div> -->

<div class="form-control">
<form action="https://formspree.io/f/myzyyepe" method="POST" onsubmit="return validateForm()">
<div class="form-inputs">
<input type="text" id="name" name="name" class="input-field" placeholder="Name" required>
<input type="email" id="email" name="email" class="input-field" placeholder="Email" required>
</div>
<div class="text-area">
<textarea id="message" name="message" placeholder="Message" required></textarea>
</div>
<div class="form-button">
<button type="submit" class="btn">Send <i class="uil uil-message"></i></button>
</div>
</form>
</div>

<script>
function validateForm() {
let name = document.getElementById('name').value;
let email = document.getElementById('email').value;
let message = document.getElementById('message').value;

if (name === "" || email === "" || message === "") {
alert("All fields must be filled out");
return false; // Prevent form submission
}

let emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if (!emailPattern.test(email)) {
alert("Please enter a valid email address");
return false; // Prevent form submission
}



return true; // Allow form submission
}
</script>



</div>
Expand Down
51 changes: 51 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,54 @@ window.onload = () => {
document.body.classList.add('light-theme'); // Default theme
}
};




{/* <script> */}
// function validateForm() {
// let name = document.getElementById('name').value;
// let email = document.getElementById('email').value;
// let message = document.getElementById('message').value;

// if (name == "" || email == "" || message == "") {
// alert("All fields must be filled out");
// return false;
// }

// let emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
// if (!emailPattern.test(email)) {
// alert("Please enter a valid email address");
// return false;
// }

// return true;
// }
// </script>



{/* <script> */}
// Set default theme to dark
document.addEventListener("DOMContentLoaded", function() {
document.body.classList.add('dark-theme'); // Set dark theme by default

// Toggle theme on button click
const toggleButton = document.getElementById('theme-toggle');
const themeIcon = document.getElementById('theme-icon');

toggleButton.addEventListener('click', function() {
document.body.classList.toggle('dark-theme');
document.body.classList.toggle('light-theme');

// Update the icon based on the current theme
if (document.body.classList.contains('dark-theme')) {
themeIcon.classList.remove('uil-sun');
themeIcon.classList.add('uil-moon'); // Change icon to moon for dark theme
} else {
themeIcon.classList.remove('uil-moon');
themeIcon.classList.add('uil-sun'); // Change icon to sun for light theme
}
});
});
{/* </script> */}
38 changes: 38 additions & 0 deletions sendmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Collect form data
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$message = htmlspecialchars($_POST['message']);

// Validate the data (simple validation)
if (empty($name) || empty($email) || empty($message)) {
echo "All fields are required!";
exit;
}

// Sanitize email and validate
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "Invalid email format!";
exit;
}

// Prepare the email
$to = "[email protected]"; // Your email address to receive the form data
$subject = "New message from $name";
$body = "Name: $name\n";
$body .= "Email: $email\n\n";
$body .= "Message:\n$message\n";

$headers = "From: $email";

// Send the email
if (mail($to, $subject, $body, $headers)) {
echo "Message sent successfully!";
} else {
echo "Failed to send the message!";
}
} else {
echo "Invalid request!";
}
?>
4 changes: 4 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,10 @@ body.dark-theme .theme-toggle {
}






.theme-toggle button {
background-color: transparent; /* Transparent background */
border: 2px solid white; /* White border */
Expand Down

0 comments on commit 50aefbe

Please sign in to comment.