P
P E Schoen
I have a list of emails (in an HTML file) that are displayed on a page in an
iframe. I also have text inputs for name, email, and a password, so that
authorized users can add their emails. The emails are kept in an SQLite
database and are accessed by a PHP script which checks authorization,
disallows duplicates, and then echoes success or failure. If it succeeds, it
updates the HTML email list in alphabetical order in the HTML file. When the
user navigates back to the original form, I want the page to be refreshed so
it shows the newly inserted email.
There were several methods discussed on some websites I found, but most of
them seemed rather complex. They often used a meta refresh, or something
like this:
window.location.reload();
location.reload(true);
location.href = location.href;
history.go(0);
http://irt.org/script/redirect.htm
http://api.jquery.com/load/
http://www.w3.org/QA/Tips/reback
Here is what I did:
<script type="text/javascript">
function CheckModified() {
if (Form1.Modified.value != "NO") {
document.location.reload(true); // true = reload from server
}
}
function SubmitEmail() {
Form1.Modified.value = "YES";
document.forms["Form1"].submit();
}
</script>
<body onLoad = "CheckModified();">
<form id="Form1" action="../cgi-bin/BGFemail2.php" method="POST">
<input type="hidden" name = "Modified" value="NO">
There is only one problem with this, as far as I can see. If the script
fails, the reload is not needed, and in fact it clears the text input fields
so they must be retyped if you want to try again.
Is there a "better" way?
This can be seen at:
http://www.pauleschoen.com/bgf/BGFemail2.htm
It will eventually be used on this website:
www.baltimoregreenforum.org
Thanks,
Paul
iframe. I also have text inputs for name, email, and a password, so that
authorized users can add their emails. The emails are kept in an SQLite
database and are accessed by a PHP script which checks authorization,
disallows duplicates, and then echoes success or failure. If it succeeds, it
updates the HTML email list in alphabetical order in the HTML file. When the
user navigates back to the original form, I want the page to be refreshed so
it shows the newly inserted email.
There were several methods discussed on some websites I found, but most of
them seemed rather complex. They often used a meta refresh, or something
like this:
window.location.reload();
location.reload(true);
location.href = location.href;
history.go(0);
http://irt.org/script/redirect.htm
http://api.jquery.com/load/
http://www.w3.org/QA/Tips/reback
Here is what I did:
<script type="text/javascript">
function CheckModified() {
if (Form1.Modified.value != "NO") {
document.location.reload(true); // true = reload from server
}
}
function SubmitEmail() {
Form1.Modified.value = "YES";
document.forms["Form1"].submit();
}
</script>
<body onLoad = "CheckModified();">
<form id="Form1" action="../cgi-bin/BGFemail2.php" method="POST">
<input type="hidden" name = "Modified" value="NO">
There is only one problem with this, as far as I can see. If the script
fails, the reload is not needed, and in fact it clears the text input fields
so they must be retyped if you want to try again.
Is there a "better" way?
This can be seen at:
http://www.pauleschoen.com/bgf/BGFemail2.htm
It will eventually be used on this website:
www.baltimoregreenforum.org
Thanks,
Paul