pkcidstudio
06-16-2006, 08:26 PM
now i have spent the better part of a hour searching for a answer on many forums. and so since i am typeing this you can imagine my amount of success to find a answer.
i have a fairly simple php form that i was trying out some functions with and it works great and well. unfortuntly the reset button only works untill you hit submit. i am wondering what the solution to this might be. i have read many places that people think it might be a javascript thing and that solution works if you want to reset your browser. but i am looking for a more direct root than that. i would like people to be able to hit the reset button and the 3 fields are cleared out. here is my code and i have imputed some explanaton to assist you in your answers.
kelly-
<html>
<head>
<title>Function Arguments Example</title>
<meta http-equiv="refresh" content="10000">
</head>
<!--the java script if you want to reset the browesr-->
<body onload="document.forms['form'].reset(); return true;">
<h1>Showing a Volume</h1>
<br />
<div>
<!--my form-->
<form name="form" action="bla.php" method="post">
<!--this is $x-->
<input type="text" maxlength="3" size="2" name="long" value="<?php echo $_POST["long"]; ?>" />
<em>Enter Length</em><br>
<!--this is $y-->
<input type="text" maxlength="3" size="2" name="wide" value="<?php echo $_POST["wide"]; ?>" />
<em>Enter Width</em><br>
<!--this is $z-->
<input type="text" maxlength="3" size="2" name="high" value="<?php echo $_POST["high"]; ?>" />
<em>Enter Highth</em><br>
<input type="submit" name="submit" value="Send ›" >
<input type="reset" name="reset" value="Reset ›" >
</div>
<?php
//simple function to mees around with varibals
if (isset($_POST["submit"]))
{
function CalcVol ($x, $y, $z)
{
$vol = $x * $y * $z;
return $vol;
}
echo "The volume of this object is " . CalcVol($_POST['long'], $_POST['wide'], $_POST['high']) . " volumetric units.";
}
?>
<?php
//simply telling people the forumula
print "<br>the formula for volume is l*w*h= Volume in units";
?>
</form>
</body>
</html>
in my searching i have noticed this is not a first time problem, but it does seam that it has never been trully answered.
kelly-
i have a fairly simple php form that i was trying out some functions with and it works great and well. unfortuntly the reset button only works untill you hit submit. i am wondering what the solution to this might be. i have read many places that people think it might be a javascript thing and that solution works if you want to reset your browser. but i am looking for a more direct root than that. i would like people to be able to hit the reset button and the 3 fields are cleared out. here is my code and i have imputed some explanaton to assist you in your answers.
kelly-
<html>
<head>
<title>Function Arguments Example</title>
<meta http-equiv="refresh" content="10000">
</head>
<!--the java script if you want to reset the browesr-->
<body onload="document.forms['form'].reset(); return true;">
<h1>Showing a Volume</h1>
<br />
<div>
<!--my form-->
<form name="form" action="bla.php" method="post">
<!--this is $x-->
<input type="text" maxlength="3" size="2" name="long" value="<?php echo $_POST["long"]; ?>" />
<em>Enter Length</em><br>
<!--this is $y-->
<input type="text" maxlength="3" size="2" name="wide" value="<?php echo $_POST["wide"]; ?>" />
<em>Enter Width</em><br>
<!--this is $z-->
<input type="text" maxlength="3" size="2" name="high" value="<?php echo $_POST["high"]; ?>" />
<em>Enter Highth</em><br>
<input type="submit" name="submit" value="Send ›" >
<input type="reset" name="reset" value="Reset ›" >
</div>
<?php
//simple function to mees around with varibals
if (isset($_POST["submit"]))
{
function CalcVol ($x, $y, $z)
{
$vol = $x * $y * $z;
return $vol;
}
echo "The volume of this object is " . CalcVol($_POST['long'], $_POST['wide'], $_POST['high']) . " volumetric units.";
}
?>
<?php
//simply telling people the forumula
print "<br>the formula for volume is l*w*h= Volume in units";
?>
</form>
</body>
</html>
in my searching i have noticed this is not a first time problem, but it does seam that it has never been trully answered.
kelly-