Hi team,

i write some logic in my page.

here i am using this $x is getting by POST method...
Logic :

if($x>10) { $amount=$amount+400; }

It is working fine.
Hare the problem is after entered into the page...incase user refresh the page that logic repeated. i dont want like that. how can i prevent this refresh option(or) logic should not be repeated.

Please give suggetion...

Use a session variable, to determine whether this code has already been executed.

Generally if form post some data on any page, better you do all db related operations or other php coding at top of page and then redirect user to some page using header.

header('Location:index.php');

without header you may face problem.
e.g. if user POST data and you have insert query in database and if you won't have header then each time user press refresh there will be record inserted in database every time.

Thaks for ur response....
Taking session variable... and after executed unset the session variable...working...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.