Jump to content

Form submits on refresh


matthewst

Recommended Posts

I have a form that keeps submitting itself when I load the page or hit refresh. I don't know how to make it stop.

 

if (isset($_POST["submit"])) {
//if($_POST["submit"]){
//if($submit) {

 

$ad_now=(mktime()-21600);
$sql_daily = "INSERT INTO ad_total_daily (img, date_time) VALUES ('1', '$ad_now')"; 
$result_daily = mysql_query($sql_daily);

 

<form action="<?=$PHP_SELF;?>" method="post" enctype="multipart/form-data" name="FormName">

 

<input type="submit" class="formTextbox" name="submit" value="Submit">

Link to comment
https://forums.phpfreaks.com/topic/72347-form-submits-on-refresh/
Share on other sites

It still submits on refresh.

 

heres more code

<?
include('include/user_check.php');
include('include/db_con.php');
$id = $_SESSION['track_id'];
            $dest_email='[email protected]';
//if (isset($_POST["submit"])) {
if($_POST["submit"]){
//if($submit) {
//insert queries that don't submit on refresh
//the following submits itself on load and refresh
$ad_now=(mktime()-21600);
$sql_daily = "INSERT INTO ad_total_daily (img, date_time) VALUES ('1', '$ad_now')"; 
        	$result_daily = mysql_query($sql_daily);
$sql_weekly = "INSERT INTO ad_total_weekly (img, date_time) VALUES ('1', '$ad_now')"; 
        	$result_weekly = mysql_query($sql_weekly); 
$sql_monthly = "INSERT INTO ad_total_monthly (img, date_time) VALUES ('1', '$ad_now')"; 
        	$result_monthly = mysql_query($sql_monthly); 
$sql_yearly = "INSERT INTO ad_total_yearly (img, date_time) VALUES ('1', '$ad_now')"; 
        	$result_yearly = mysql_query($sql_yearly); 
$sql_ytd = "INSERT INTO ad_total_ytd (img, date_time) VALUES ('1', '$ad_now')"; 
        	$result_ytd = mysql_query($sql_ytd);
//end self submit
            ?>

<?php
unset($_POST);
?>


//all my form junk

 

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.