Re: Class/functions question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was able to get part of my page to load when I created the
Validation class and put a call to the validation class within my
table.  When I did that the  page loaded up until the php code to call
the method and then it does not load the rest of the page.    Can
anyone help me with this?  By the way I am calling $_POST["name"] as
the parameter to be passed into the function

so my php code looks like:
<?php

$a = new Validation;
$a->checkEmpty($_POST["name"]);
?>

Paul
On 2/12/06, Chris Shiflett <shiflett@xxxxxxx> wrote:
> Paul Goepfert wrote:
> > I know how to call functlions, I just just don't know how to
> > do it in PHP.
>
> Based on the rest of your question, I think you mean methods, not
> functlions. :-)
>
> If you're struggling with syntax, you should take one step at a time.
> Try this:
>
> <?php
>
> class myClass
> {
>      function myMethod()
>      {
>          echo '<p>myMethod()</p>';
>      }
> }
>
> $myObject = new myClass;
>
> $myObject->myMethod();
>
> ?>
>
> That should help you with any syntax problems, but I suspect your
> problem has more to do with logic than with syntax.
>
> > if (isset($submit))
> > {
> >    class Validation
> >    {
>
> /* ... */
>
> >    }
> > }
> > else
> > {
>
> /* ... */
>
> >    $v = new Validation;
> >    $v->checkEmpty($_POST["name"]);
>
> If the form is submitted, define the class, else use the class. That
> doesn't sound right...
>
> Hope that helps.
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux