Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:24:27+00:00 2026-05-22T20:24:27+00:00

<body> <?php if(isset($_POST[‘vendor_add_submit’])){ //INSERT INTO DB unset( $_POST[‘vendor_add_submit’] ); } ?> <form method=post action=<?php

  • 0
<body>

<?php

if(isset($_POST['vendor_add_submit'])){

//INSERT INTO DB

unset(  $_POST['vendor_add_submit'] );
}

?>


<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" >


<label>Email</label>
<input type="text" name="vendor_email" value="" />


<input type="submit" name="vendor_add_submit" value="SAVE" />


</form>
</body>

unset( $_POST['vendor_add_submit'] ); is used to prevent more than one time insertion into db on page refresh. I tested with print_r($_POST['vendor_add_submit'] ) before and after the unset and found that the unset() function does not work.

How can I achieve the purpose of the unset function, plz?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:24:28+00:00Added an answer on May 22, 2026 at 8:24 pm

    Unset isn’t going to stop the refresh from being able to replay the POSTed data to the script. The unset function eliminated it for the remaining execution of that script, but a refresh is a fresh execution.

    You could simply re-direct the browser to the entry pageafter doing your insert, that way a subsequent refresh will be safe.

    //INSERT INTO DB
    //...
    header('Location: samepage.php');
    exit();
    

    I’m sure there are other ways to accomplish this as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$.post('includes/script.php', $(this).serialize(), function(data) { $('body').append(data); }); alert ($('#new').length) php script is <php echo <div
I have the basic html form echoed through php: <html> <body> <?php if (isset($_GET[pk]))
My PHP site has header,body,footer files that are included into the INDEX.PHP page. On
Here is my code <html> <body> <?php echo <b>Hello World</b> <br />; ?> </body>
My email code isn't working. <?php if(isset($_POST['send'])){ $to = info@erbimages.com ; // change all
I have the following code sample upload3.php: <html> <head> <title>PHP Form Upload</title> </head> <body>
<?php if (isset($_POST['first']) && isset($_POST['second']) && isset($_POST['submit']) && $_POST['DDL'] == "+") { $equals =
For example i use this little code: <?php if (isset($_POST['Submit'])){ if ((@$_POST['Submit'] == 'x'))
<?php session_start(); if(isset($_POST['username']) && ($_POST['password'])) { $con=mysql_connect(localhost,root,); if(!$con) { die('Could Not Connect:'.mysql_error()); } mysql_select_db(tcs,$con);
I am wondering if php methods are ever defined outside of the class body

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.