| |

VerySource

 Forgot password?
 Register
Search
View: 19|Reply: 5

Form problem

[Copy link]

2

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-3-11 22:30:01
| Show all posts |Read mode
There are two pages a.php and b.php
 a.php filling form data
 b.php is used to extract the form content and add records!
 But clicking back on the menu will add an extra record. This will judge a few more.
 Excuse me: Is there any good way, or is there a way to delete the content from the post after the submission is successful!
Reply

Use magic Report

0

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-6-7 09:00:01
| Show all posts
I usually do this

<?php
if(isset($_POST['submit'])&&$_POST['submit'] == "OK"&&$_POST['lastAction']>$_SESSION['userLastAction'])
{
$_SESSION['userLastAction']++;
...
}
?>

<form name="form1" method=post action="<?=$_SERVER['PHP_SELF'] ?>">
...

<input type=Hidden name=lastAction value=<?=$_SESSION['userLastAction']+1 ?>>
<input type=reset name=reset value="reset">&nbsp;
<input type=submit name=submit value="OK"
</form>
Reply

Use magic Report

2

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-6-10 11:15:01
| Show all posts
Unique idea!
I solved it in this way, but I just can't return, can you return like that>?
<form action="a.php?act=regiest">
</form>
After adding
Refresh this page
location.href='b.php'
Reply

Use magic Report

2

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-6-10 15:15:01
| Show all posts
But when act is passed with hidden, an error will occur!
Reply

Use magic Report

0

Threads

26

Posts

15

Credits

Newbie

Rank: 1

Credits
15

 China

Post time: 2020-6-23 11:00:01
| Show all posts
Cookie+timestamp to prevent
Reply

Use magic Report

0

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-6-25 16:15:01
| Show all posts
Can return
Through judgment, the content in the IF will not be executed
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list