Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Donation Form</title>
</head>
<body>

<h1>Donate</h1>

<form id="donationForm">
<label for="amount">Amount:</label>
<input type="number" id="amount" name="amount" min="1" step="1"
required><br><br>

<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>

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

<button type="submit">Donate</button>
</form>

<script>
document.getElementById("donationForm").addEventListener("submit", function(event)
{
event.preventDefault(); // Prevent the form from submitting normally

// Get form data


var amount = document.getElementById("amount").value;
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;

// Perform donation processing (you would replace this with your actual
donation processing code)
// For this example, we'll just log the data to the console
console.log("Donation Information:");
console.log("Amount: $" + amount);
console.log("Name: " + name);
console.log("Email: " + email);

// Optionally, you can redirect the user to a thank you page after processing
the donation
// window.location.href = "thankyou.html";
});
</script>

</body>
</html>

You might also like