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
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];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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