Hello,

I read an article on "how to prevent users from submitting a form twice." at the url http://www.4guysfromrolla.com/webtech/100406-1.shtml

I was able to freeze the web page but was not able to unfreeze the web page. I am using PHP with javascript. Nothing happens when my code executes the "unfreeze" js function. I tested this js function and it only worked after I disabled the 2 php header() functions below. The JS unfreeze function just stops working with the php header functions enabled. There were no errors. Only the web page still freezes.

I hope someone can give me advice to help me solve this issue. Thanks in advance.

Below is my code in short version:

<?php
ob_start();

$hearingform = '
<html>
<head>

<style type="text/css">
.....
</style>

<div align="center" id="FreezePane" class="FreezePaneOff">
<div id="InnerFreezePane" class="InnerFreezePane"> </div>
</div>

<script type="text/javascript">

function FreezeScreen(msg) {
scroll(0,0);
var outerPane = document.getElementById("FreezePane");
var innerPane = document.getElementById("InnerFreezePane");
if (outerPane) outerPane.className = "FreezePaneOn";
if (innerPane) innerPane.innerHTML = msg;
}

function unFreezeScreen() {
var outerPane = document.getElementById("FreezePane");
outerPane.className = "FreezePaneOff";
}';

//---------------------------------------------------------
// some code to pull data from the database here...
//---------------------------------------------------------

// unfreeze the webpage
echo '<script type="text/javascript">unFreezeScreen();</script>';

/*send data to an excel file*/
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=$filename");

echo $data;

exit;
} //END post IF

print $hearingform;

ob_flush();
?> 

It's not clear, is this a script that composes the page with the form on it or a script that's executed in response to the form being submitted?

Much of the code indicates the one and the rest indicates the other.

are you submitting the form via ajax? bring in the code bro

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.