Calorie Calculator PHP
Hello guys my name is Sinan Karayaman. I have been working on wordpress and other web services for few years now.
This program coded for calorie calculator, with calorie calculation script you can calculate your calories very simply with the help of form labels. I explain below in order to help you explain the functions used in the script.
- isset : Determine if a variable is set and is not NULL
fuctions.php
<?php
/*
Sinan KARAYAMAN
*/
if(isset($_POST['Yas']) && isset($_POST['Kilo']) && isset($_POST['Boy'])){
$Yas=$_POST['Yas'];
$Kilo=$_POST['Kilo'];
$Boy = $_POST['Boy'];
$cinsiyet=$_POST['cinsiyet'];
switch ($cinsiyet){
case 'Female':
$cinsiyet= 655 + (9.6 * $Kilo ) + (1.8 * $Boy) - (4.7 * $Yas);
echo "<p>Tahmini günlük metabolizma hızınız $cinsiyet </p>";
echo "<p>Bu şu anki kilonuzu korumak için günde kabaca $cinsiyet kaloriye ihtiyacınız olduğu anlamına gelir.</p>";
break;
case 'Male':
$cinsiyet=66 + (13.7 *$Kilo) + (5 * $Boy) - (6.8 * $Yas);
echo "<p>Tahmini günlük metabolizma hızınız : $cinsiyet </p>";
echo "<p>Bu şu anki kilonuzu korumak için günde kabaca $cinsiyet kaloriye ihtiyacınız olduğu anlamına gelir.</p>";
break;
}
}
?>
index.php
<!DOCTYPE html>
<html>
<head>
<title>KALORI HESAPLAMA</title>
<style type="text/css">
*{
font-family: arial;
color: #666;
}
</style>
</head>
<body>
<center>
<h2>KALORI HESAPLAMA</h2>
<form action="functions.php" method="post">
Cinsiyeti Seçin:<br />
<select name="cinsiyet" style="padding: 5px; width: 265px; border-radius: 3px; border: 1px solid #ddd;"><br />
<option value="Male">Erkek</option>
<option value="Female">Kadin</option>
</select><br /><br />
<input name="Yas" type="text" placeholder="Yaşınızı Girin" style="padding: 5px; width: 250px; border-radius: 3px; border: 1px solid #ddd;" /><br /><br />
<input name="Kilo" type="text" placeholder="Kilonuzu Girin" style="padding: 5px; width: 250px; border-radius: 3px; border: 1px solid #ddd;" /><br /><br />
<input name="Boy" type="text" placeholder="Boyunuzu Girin" style="padding: 5px; width: 250px; border-radius: 3px; border: 1px solid #ddd;" /><br /><br />
<input type="Submit" value="HESAPLA" style="padding: 10px 5px; width: 265px; border-radius: 3px; border: 1px dashed #ddd; background-color: white;" />
</form>
</center>
</body>
</html>
- Result
Github url : https://github.com/sinankarayaman/Kalori-Hesaplama
Posted on Utopian.io - Rewarding Open Source Contributors
Nice , love programming...
Keep it up bro. Very soon you might be the best programmer in the world
we will wait for you better
cool stuff. keep up the work :)
Your contribution cannot be approved yet because we feel its too trivial for a development contribution. We can still accept this contribution as tutorial, if you will explain it well what have you done.
See the Utopian Rules. Please edit your contribution to reapply for approval.
You may edit your post here, as shown below:
You can contact us on Discord.
[utopian-moderator]
Php is a programmable area, people can take php projects and use them in their php software.
It's not tutorial.Check this please
https://utopian.io/utopian-io/@justyy/adding-ipify-api-support-in-chrome-extension-what-is-my-ip
You can check rules ;
Development Rules
Only merged Pull Requests will be accepted or Open Source projects you maintain never posted on Utopian before, forks included as long as the fork is not just a mirror of the original one. Proof of work required.
In this category you can only write if you have developed or contributed to the development.
You must provide the links to the branches/forks/gists/pull requests.
If your username on Github does not correspond to the Utopian username you must provide proof you are the owner by providing a screenshot of the logged in session in Github.
Images, screenshots, links and examples are not necessary but preferred.
Never write about code contributions you have already shared before.
Good stof.keep it up
HI dear... can you upvote me please
Nice programming. My friend had a simlar program where he tried to recreate the Program used by a fitness app as part of a project. Very neat and cool.
Great post🌹🌹🌹💜💜💜🌹🌹
Thank you for the contribution. It has been approved. Next time if a contribution is too trivial we will not accept it as a development contribution.
You can contact us on Discord.
[utopian-moderator]
For who trivial ?
Thank you for following me and I have followed back.