/    Sign up×
Community /Pin to ProfileBookmark

Message and Errormessage Handling

I need some suggestion and advise how to do the follow idea:

I have a form and send all data to a process.php script. Once the email is sent, the customer returns back to the “form”.

How do I implement in a best way – to show the customer like “Thank You for the booking….”.

In the process.php script I have, the follow line:

[code=php]header(‘Location:/’.$lang.’/courses/booking’);[/code]

It would be nice, if I can send here a message over…

Need some advise, with examples if possible.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 15.2014 — Probably the simplest solution within that context (doing a redirect) is to make use of session variables. If so, I've found it to sometimes be necessary to do a session_write_close() just before you do the header() redirect.
Copy linkTweet thisAlerts:
@SimonvetterliauthorDec 15.2014 — Hi

Sounds interesting. Do You have an example?

Kindly
Copy linkTweet thisAlerts:
@NogDogDec 15.2014 — form-handler:
[code=php]
<?php
session_start();

$_SESSION['error_msg'] = "Oops!";
session_write_close();
header('Location: http://example.com/form.php');
exit;
[/code]

form.php:
[code=php]
<?php
session_start();
if(!empty($_SESSION['error_msg'])) {
echo "<p class='error'>".$_SESSION['error_msg']."</p>n";
}
[/code]
×

Success!

Help @Simonvetterli spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...