Refer to the following line numbers:
01 > <?php 02 > // Start of PHP code - Extract values from form. 03 > /* Other values read */ 04 > $n=$_POST['n']; 05 > 06 > // Pass the data from the form to lightcurve_csharp 07 > $command="./lightcurve_csharp $a $i $e $lomega $bomega $lambda $n"; 08 > $result=`$command`; 09 > 10 > $form_submitted=$_POST['form_sumbitted']; 11 > if (isset($form_submitted)) { 12 > if ($form_submitted) { 13 > echo 'The form has been submitted<br>'; 14 > unset($form_submitted); 15 > } 16 > } else 17 > echo 'The form has not been submitted<br>';
When the user first load the page, no data was posted. So there was no $_POST['form_sumbitted'] available. Line 10 will cause $form_submitted to contain the NULL value (I think). $form_submitted will evaluate to FALSE at line 12. Thus it will not display any message.
By the way, by doing line 10, $form_submitted would have been set regardless whether there is $_POST['form_sumbitted'], and line 11 will evaluate to TRUE always. Thus you will never ever see the 'form not been submitted' message.
Anyway, when you posted for the first time, $_POST['form_sumbitted'] is available. The 'The form has been submitted<br>' message will be printed. After that, when you press Reload button on the browser, the post data will once again be sent from the user. (This is the behaviour of reloading a posted page. In Internet Explorer there should be a message dialog box asking the user whether to resend form data in order to refresh.) Reposting the data during the reload means that there will be $_POST['form_sumbitted'], thus once again the 'form hass been submitted' message.
In order to prevent this from happening, you should do a header('Location: success-page.php') on a successful submit. This is so that at the redirected page, the user would not have resent data even if he press the Reload button.
Hope this helps
-Leon
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php