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.

Link to comment
Share on other sites

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

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.