after submit page....
Moderator: General Moderators
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
after submit page....
I have 2 pages where users submit info and it submits to a database and redirects them to a main page. The site uses session variabls. I was just wondering...
is there a way so i can make the main index.php page (the page that has the login info) detect whether or not a person has just submitted a form on a seperate page (one that is verified under the session variables) so that I can tell them in a little bold print message on the main page that their support request has been received and that it will be answered shortly?
Yet, when the user first logs in they goto the index.php page as well and I want to make sure they dont have messages saying your support request has been received if they haven't yet done anything.
if what i'm describing is too hard to understand i can try to explain more .
is there a way so i can make the main index.php page (the page that has the login info) detect whether or not a person has just submitted a form on a seperate page (one that is verified under the session variables) so that I can tell them in a little bold print message on the main page that their support request has been received and that it will be answered shortly?
Yet, when the user first logs in they goto the index.php page as well and I want to make sure they dont have messages saying your support request has been received if they haven't yet done anything.
if what i'm describing is too hard to understand i can try to explain more .
well, not unless you pass a variable along w/ the URL you're redirecting to, I don't think so.
Why not display the message "your support request has been received" one the second page when you add the data to the database.
Then have a link back to the main index.php page or do a Meta redirect, where it automatically redirects the user after a specified amount of time, lets like after 10 secs, they'll be directed to the main page if they dont click on the link.
Why not display the message "your support request has been received" one the second page when you add the data to the database.
Then have a link back to the main index.php page or do a Meta redirect, where it automatically redirects the user after a specified amount of time, lets like after 10 secs, they'll be directed to the main page if they dont click on the link.
- protokol
- Forum Contributor
- Posts: 353
- Joined: Fri Jun 21, 2002 7:00 pm
- Location: Cleveland, OH
- Contact:
This is how I do it:
I keep a $_SESSION['user_message'] variable which stores error messages, confirmations, etc. Then I use these two functions:
Now, whenever I want to tell the user something I do:
setUserMessage("Thanks for the information!");
setUserMessage("You must fill in required information!", true); // sets error message flag
In each script, I pick a spot that I want user messages to be displayed and I simply put:
<?php printUserMessage() ?>
Now, I have a nice user/error message system which I can put into any script.
I keep a $_SESSION['user_message'] variable which stores error messages, confirmations, etc. Then I use these two functions:
Code: Select all
function setUserMessage($message, $error=false) {
session_start();
if ($error)
$_SESSIONї'user_message'] = "<span style="color: red">$message</span>";
else
$_SESSIONї'user_message'] = $message;
}
function printUserMessage() {
session_start();
if ($_SESSIONї'user_message'] != "")
echo $_SESSIONї'user_message'];
$_SESSIONї'user_message'] = ""; // message has been displayed so reset it
}setUserMessage("Thanks for the information!");
setUserMessage("You must fill in required information!", true); // sets error message flag
In each script, I pick a spot that I want user messages to be displayed and I simply put:
<?php printUserMessage() ?>
Now, I have a nice user/error message system which I can put into any script.
Last edited by protokol on Wed Jul 10, 2002 4:29 pm, edited 1 time in total.
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
- protokol
- Forum Contributor
- Posts: 353
- Joined: Fri Jun 21, 2002 7:00 pm
- Location: Cleveland, OH
- Contact:
Any time you use setUserMessage("some message"), the $_SESSION['user_message'] will remain active up until you call printUserMessage().
If you look in the printUserMessage() function, the last thing it does is:
$_SESSION['user_message'] = "";
So, now if you haven't called setUserMessage() again and the printUserMessage() function is called, nothing will be displayed.
Since it is a session variable, no matter what page you set it on, you can print it on any other page.
If you look in the printUserMessage() function, the last thing it does is:
$_SESSION['user_message'] = "";
So, now if you haven't called setUserMessage() again and the printUserMessage() function is called, nothing will be displayed.
Since it is a session variable, no matter what page you set it on, you can print it on any other page.
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact: