Jump to content

Stop all forms on a page submitting at same time??


Vivid Lust

Recommended Posts

I have the code:

 

<?php

$sumfile = "sum.txt";
$file = fopen( $sumfile, "r");
$filesize = filesize($sumfile);
$sum = fread($file, $filesize);
fclose( $file );
echo $sum;
?>

<form name="1" method="post" action="
<?php
$sumfile = "sum.txt";
$file = fopen( $sumfile, "a");
fwrite( $file, "1");
fclose( $file );
?>">
<input type="submit" name="one" value="1">
</form>
<form name="2" method="post" action="
<?php
$sumfile = "sum.txt";
$file = fopen( $sumfile, "a");
fwrite( $file, "2");
fclose( $file );
?>">
<input type="submit" name="two" value="2">
</form>

 

And everytime i click on one input submit button both forms submit; this happens when refreshing aswell. (Im making a calculator)

 

Please help!

 

thanks in advanced and merry xmas.

frankly this is not a submit issue, you can't put php code in the action of a form. as it is right now, it is just executing as php generates the form page. there is nothing in the action of the form if you look at source in your browser. so any submit, is just going to calc all the code you have in <?php .... ?> blocks

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.