Re: [PHP] message to user after complete POST

2013-09-04 Thread Rodrigo Santos
hey, if you are just trying to give the user a feedback about the
information sent, there is a Global variable for this, and it's the $_POST.
When you receive the information on the script you called on the "Action"
atribute of the form, via the $_POST global variable, you will test the
information end echo the feedback on that script.

Note that, unless you are using ajax (jquery, or any other javascript ajax
method), when you post a form, you will be intantly redirected to the
"action" path. then you have nothing to do in the source page.

hope you got it.


2013/9/4 iccsi 

> I have a POST form and action itself like following
> 
> 
>
> I want to show success message when POST complete or error message if
> there is any.
> I would like to know are there any property or global variable I can check
> to show message to users.
> If not, it seems that the only solution is jQuery, since it has success
> function that jQuery call after POST.
>
> Your help and information is great appreciated,
>
>
> Regards,
>
> Iccsi,
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Static utility class?

2013-09-04 Thread Rodrigo Santos
Hi, first, sorry for the bad English.

Yes, at least, as far as I know, this is the perfect way to do what you
want to do. Think like this: when you instanciate a class, you are
allocating memory. If you don't need any information stored, then you don't
need to allocate memory, right? So, it's is logic to have a class that you
will call only one fragment when you need it, rather than load the entire
class just for one method.

Just be careful to organize your utility methods by by meaning. Don't put a
method that make dating stuff and a method that write a random string in
the same class. By doing so, you are breaking the object orientation
purpose.


2013/9/4 Micky Hulse 

> Hi all!
>
> Example code:
>
> 
>
> Goal:
>
> I want to have a "utility" class that contain utility methods which should
> have the option of being called multiple times on a page.
>
> I think my main goal is to avoid having to "new" things ... I don't really
> need to create an instance here (there's no need for a constructor in this
> case).
>
> Question:
>
> Is the above simple pattern a good way to have a class that calls static
> methods?
>
> To put it another way, is there any reason why I would not want to use the
> above code?
>
> Basically I want to wrap these simple functions in a nice class wrapper and
> have the ability to call them without having to jump through more hoops
> than is necessary.
>
> Are there any pitfalls to writing a class like this? Or, is this the
> standard way of writing a simple "utility" class for this type of
> situation?
>
> Please let me know if I need to clarify my questions.
>
> Thanks for your time?
>