Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arfhad-shaikh committed Jul 29, 2021
1 parent 521c5e3 commit 08375cf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
47 changes: 27 additions & 20 deletions cgi/cgi_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<input type="number" id="weight" name="weight" placeholder="Your weight in kg..">
<button type="submit" class="signupbtn" onclick="calculateBMI()">Calculate BMI</button>
<br/><br/>
<p id="BMI"> </p>
<p id="BMI-result"> </p>
</div>
Expand All @@ -65,7 +65,7 @@
var result = "";
if(weight > 0 && height > 0){
var BMI = Math.round(weight/(height/100*height/100));
document.getElementById("BMI").innerHTML = BMI;
document.getElementById("BMI").innerHTML = "Your BMI is" + BMI;
if(BMI < 18.5){
document.getElementById("BMI-result").innerHTML= "You are too thin.";
result="That you are too thin.";
Expand All @@ -82,31 +82,38 @@
else{
alert("Please Fill in everything correctly");
}
document.body.innerHTML += "<button type=\\"button\\" onclick=\\"sendEmail()\\" class=\\"signupbtn\\"> Email results to: $data{email} </button>"
}
document.body.innerHTML += "<button type=\\"button\\" onclick=\\"sendEmail()\\" class=\\"signupbtn\\"> Email results to: $data{email} </button>"
function sendEmail() {
result = document.getElementById("BMI-result").innerText;
bmi = document.getElementById("BMI").innerText;
Email.send({
Host: "smtp.elasticemail.com",
Username : "account_validation\@learn.taliaq.com",
Password : "8CDE0ED2F1E5FA245FBCD6EE5B35CD9D0942",
To : "$data{email}",
From :"theolaanstra\@gmail.com",
Subject : "BMI Results",
Body : "Hi \\n Your BMI result says that \\"" + result + "\\"\\r\\nYour BMI is " + bmi
}).then(
function(message) {
console.log("Email Status: " + message);
if (message == "OK") {
document.body.innerHTML += "<br>Email sent - check your junk folder!";
} else {
document.body.innerHTML += "<br>" + message;
}
if (result == "" && bmi == "")
{
alert("Enter Height & Weight");
}
);
else{
Email.send({
Host: "smtp.elasticemail.com",
Username : "account_validation\@learn.taliaq.com",
Password : "8CDE0ED2F1E5FA245FBCD6EE5B35CD9D0942",
To : "$data{email}",
From :"theolaanstra\@gmail.com",
Subject : "BMI Results",
Body : "Hi \\n Your BMI result says that \\"" + result + "\\"\\r\\nYour BMI is " + bmi
}).then(
function(message) {
console.log("Email Status: " + message);
if (message == "OK") {
document.body.innerHTML += "<br>Email sent - check your junk folder!";
} else {
document.body.innerHTML += "<br>" + message;
}
}
);
}
}
</script>
</body>
</html>
Expand Down
6 changes: 3 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pre {
}

/* -------------------Contact Form--------------------------*/
input[type=text], select, textarea, input[type=password], input[type=email]{
input[type=text], select, textarea, input[type=password], input[type=email], input[type=number]{
width: 100%;
padding: 12px;
border: 1px solid #ccc;
Expand Down Expand Up @@ -277,7 +277,7 @@ li.active > button.nav-button {
}*/

/* Full-width input fields */
input[type=text], input[type=password], input[type=email] {
input[type=text], input[type=password], input[type=email], input[type=number]{
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
Expand All @@ -287,7 +287,7 @@ input[type=text], input[type=password], input[type=email] {
}

/* Add a background color when the inputs get focus */
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus {
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, input[type=number] {
background-color: #ddd;
outline: none;
}
Expand Down

0 comments on commit 08375cf

Please sign in to comment.