Here is my stuff below if you can look at it and someone could help me i would appreciate it...
HTML
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ajax C-F conversion</title>
<style>
.NoNum {color:red; font-weight:bold;}
</style>
<script>[/html]
Expand|Select|Wrap|Line Numbers
- var http = createRequestObject();
- function createRequestObject() {
- var ro;
- var browser = navigator.appName;
- if(browser == "Microsoft Internet Explorer"){
- ro = new ActiveXObject("Microsoft.XMLHTTP");
- }else{
- ro = new XMLHttpRequest();
- }
- return ro;
- }
- function convertTemp(argTemp) {
- http.open('get', 'convert.php?temp='+argTemp);
- http.onreadystatechange = handleResponse;
- http.send(null);
- }
- function handleResponse() {
- if(http.readyState == 4){
- document.getElementById("results").innerHTML = http.responseText;
- }
- }
</head>
<body>
<div>
<form name="myForm" action="#">
<h1>Enter Degrees Here:</h1>
<input type="text" name="temp">
<select name="type" id="type">
<option value="CF">Centigrade to Farenheit</option>
<option value="FC">Farenheit to Centigrade</option>
</select>
<input type="button" value="Submit" name="btnSubmit" onclick="convertTemp(this.value);"/>
</form>
</div>
<h1>Degrees Fahrenheit</h1>
<div id="results">
</div>
</body>
</html>[/html]
PHP SCRIPT
[PHP]<?php
$type=$_GET["type"];
$temp=$_GET["temp"];
if ($type=="CF"){
$convert=($temp*9/5)+32;
print ($convert);
}
if ($type=="FC"){
$convert=($temp-32)*(5/9);
print ($convert);
}
?>[/PHP]