FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Newbie: Displaying a 'message box'
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Newbie: Displaying a 'message box' [message #169793 is a reply to message #169788] Mon, 27 September 2010 01:53 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 27/09/10 00:13, Richard Holmes wrote:

> After a user has submitted a form I would like to display a message
> from a PHP function to acknowledge the input if the form is entered
> correctly or an error message if the input is incorrect. I've searched
> Google and the PHP manual but I haven't found an equivalent to a
> 'message box'. Any suggestions? TIA!

Assuming you're using php to validate and process the form data, at some
point in the php code do something like this:

if ($validated) {
if ($processed) {
// validation & processing ok
echo "<p>Thanks, your submission
has been processed.</p>";
echo "<p>Please <a href='some_link'>click</a>
to return to our home page.</p>";
}
else {
// processing failed
echo "<p>Sorry, there was a server error.</p>";
echo "<p>Please <a href='some_link'>try later</a></p>";
}
}
else {
// validation failed
echo "<p>Sorry, the data you submitted was not valid.</p>";
echo "<p>Please <a href='some_link'>try again</a></p>";
}

If you're using ajax to handle the request, you probably only want to
echo back a single text string that you can then use in an alert box.
You can ember carriage returns (\n) in such a string if you wish.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Array variable in echo statement
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 23:30:20 GMT 2024

Total time taken to generate the page: 0.04008 seconds