Jump to content

How Can I Reset My PHP Form And Page?


lotrfan

Recommended Posts

I have a PHP form that users can put in floats, integers, etc. that performs calculations. My PHP then uses  $_REQUEST to get the values. However I would like to allow them to reset the values in the form as well as the text the PHP echoes to the page by clicking "RESET" button.

 

I included an input type for 'reset' but it does not work.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/73264-how-can-i-reset-my-php-form-and-page/
Share on other sites

Oh, almost forgot, here's the script for the forms...

 

<form method="post" action="hypotenuse.php" onKeyPress="return numbersonly(this, event)">

<p>Side a</p><input name="side_a" type="text" /><br />
<p>Side b</p><input name="side_b" type="text" /><br />
<p>Side c</p><input name="side_c" type="text" /><br />
<p>Angle A</p><input name="angle_a" type="text" /><br />
<p>Angle B</p><input name="angle_b" type="text" /><br />
<p>Angle C</p><input name="angle_c" type="text" /><br />

<input type="submit" value="GO!" />
<input type="reset" value="Reset" />
</form>

 

and PHP side...

 

$side_a = $_REQUEST[side_a];
$side_b = $_REQUEST[side_b];
$side_c = $_REQUEST[side_c];
$angle_a = $_REQUEST[angle_a];
$angle_b = $_REQUEST[angle_b];
$angle_c = $_REQUEST[angle_c];

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.