Jump to content

kyle01

New Members
  • Posts

    7
  • Joined

  • Last visited

kyle01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you everyone. It is now working
  2. so is everything alright with the actual code?.. I am just simply using notepad++ and then running the index.html page off of it to see what it looks like. is this an okay way of doing it or is that why I am getting the blank page?
  3. Could you help by editing the code i have submitted or just submitting the new version of the changed code, I am very new to this html and php and don't really have much of a clue as to what I am doing. Thank you
  4. also as a side note; I am using notepad++ to edit the code if that has any importance
  5. Thank you, can you please help with any other problems with this code, it's kind of an emergency
  6. Ah sorry, new to this website, just signed up now, but thank you. Basically, the program runs, as in the html form shows up in Google Chrome, but when i enter a integer into the field and press convert. it just goes to a blank html page and thats about it. I need the form to show the converted result on the html page. Thank you
  7. Hi there, I have this conversion program I am trying to make. Basically I have one file called 'index.html' and another called 'convert.php', the basic function of this program is to show a form in the html page and then get the calculation from the php form and then show the result back on the html page. The html page uses a dropdown list of different conversions the user can select from. Below is the code I've got. Please can you help with fixing this thing! It's really annoying me! :@ HTML CODE: <HTML> <HEAD> <title>Unit Converter</title> </HEAD> <BODY> <h1>CONVERSION</h1> <form action="convert.php" method="post"> <link rel="StyleSheet" media="screen" href="convert.css"> Type of conversion: <br> <select name="conversionType"> <option value="null" selected="selected">Select type...</option> <option value="null"></option> <option value="null">--Temperature--</option> <option value="C-F">Celsius to Fahrenheit</option> <option value="C-K">Celsius to Kelvin</option> <option value="C-R">Celsius to Rankine</option> <option value="K-C">Kelvin to Celsius</option> <option value="K-F">Kelvin to Fahrenheit</option> <option value="K-R">Kelvin to Rankine</option> <option value="F-C">Fahrenheit to Celsius</option> <option value="F-K">Fahrenheit to Kelvin</option> <option value="F-R">Fahrenheit to Rankine</option> <option value="R-C">Rankine to Celsius</option> <option value="R-K">Rankine to Kelvin</option> <option value="R-F">Rankine to Fahrenheit</option> </select> <br><br> Value to convert:<br> <input type="text" name="conversionInput"> <br><br> <input type="submit" value="Convert"> </form> </BODY> </HTML> PHP CODE: <HTML> <title>Conversion Output</title> </HTML> <?php $conversionType = $_POST['conversionType']; $conversionInput = $_POST['conversionInput']; $conversionValue; $conversionFrom; $conversionTo; if ($conversionType == 'C-F') { $conversionValue = $conversionInput * (5/9) + 32; $conversionFrom = "° Celsius"; $conversionTo = "° Fahrenheit"; } if ($conversionType == 'C-K') { $conversionValue = $conversionInput + 273.15; $conversionFrom = "° Celsius"; $conversionTo = "° Kelvin"; } if ($conversionType == 'C-R') { $conversionValue = ($conversionInput + 273.15) * (9/5); $conversionFrom = "° Celsius"; $conversionTo = "° Rankine"; } if ($conversionType == 'K-C') { $conversionValue = $conversionInput - 273.15; $conversionFrom = "° Kelvin"; $conversionTo = "° Celsius"; } if ($conversionType == 'K-F') { $conversionValue = $conversionInput * (9/5) - 459.67 ; $conversionFrom = "° Kelvin"; $conversionTo = "° Fahrenheit"; } if ($conversionType == 'K-R') { $conversionValue = $conversionInput * (9/5); $conversionFrom = "° Kelvin"; $conversionTo = "° Rankine"; } if ($conversionType == 'F-C') { $conversionValue = ($conversionInput - 32) * (5/9) ; $conversionFrom = "° Fahrenheit"; $conversionTo = "° Celsius"; } if ($conversionType == 'F-K') { $conversionValue = ($conversionInput + 459.67) * (5/9); $conversionFrom = "° Fahrenheit"; $conversionTo = "° Kelvin"; } if ($conversionType == 'F-R') { $conversionValue = $conversionInput + 459.67; $conversionFrom = "° Fahrenheit"; $conversionTo = "° Rankine"; } if ($conversionType == 'R-C') { $conversionValue = ($conversionInput + 491.67) * (5/9); $conversionFrom = "° Rankine"; $conversionTo = "° Celsius"; } if ($conversionType == 'R-K') { $conversionValue = $conversionInput * (5/9); $conversionFrom = "° Rankine"; $conversionTo = "° Kelvin"; } if ($conversionType == 'R-F') { $conversionValue = $conversionInput - 459.67; $conversionFrom = "° Rankine"; $conversionTo = "° Fahrenheit"; } echo "$conversionInput $conversionFrom = $conversionValue $conversionTo"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.