Hi
I have some experience with programming, but i'am very new in PHP and i want to know hat is the best way to show a page with a sucess message after a script execution.
Any suggestions ?
Printable View
Hi
I have some experience with programming, but i'am very new in PHP and i want to know hat is the best way to show a page with a sucess message after a script execution.
Any suggestions ?
There are many, many ways.Quote:
Originally Posted by Desbaratizador
You could create a dynamically generated one, you could use a template fom a database, you cold use the include() function to include a premade file or any combination of those, can you be a bit more specific about your needs?
Cheers,
Ryan Jones
I want to show a "Operation completed with sucess" message after a user fire a submit button. What i need is a example of a dynamically generated one (or other).
Thanks on advance
I assume submit is on a form and the form action points to your PHP script, so don't output anything during the script execution and after it's finished you could check whether it was succesful and condiitonally display an HTML message.
Example: Lets say $success is true or false depending on whether the script worked.
PHP Code:<?php
// script goes here...
?>
<html>
<head>
<title>Success</title>
</head>
<body>
<?php
if ($success)
{
?>
<p>It worked, yay</p>
<?php
}
else
{
?>
<p>Oh crap, something went wrong! :-(</p>
<?php
}
?>
</body>
</html>
It also dependso n what you consider to be success, what does the script do with the submitted data and what would you need to test in order to assertain whethher the script failed?
OK. Thanks.
With the examples submited as help i made the target.