Jump to content

lucerias

Members
  • Posts

    101
  • Joined

  • Last visited

    Never

Everything posted by lucerias

  1. I have gone through the information of $_REQUEST of PHP.net but still can't get the idea on $_REQUEST. Can you guys explain it in an understandable way? You may provide example for explanation if necessary. Thank you.
  2. Thank you, i am clear with your example. Another problem of class and function is i tried to create a sum relationship to understand more about class and function. The "First" coding shown as below can work properly whereas i have another idea is define the $val1 and $val2 in function variable() and then $val3 in function foo(), so the calculation will be done in function foo() by passing the value of $val1 and $val2 from variable() to foo(). The "Second" coding is what i have tried to do but there is error, please help me to resolve it. Thank you. First [code]<?php $val1=1; $val2=2; $val3=0; class Foo {      function Variable()     {          global $val1;          global $val2;         global $val3;                 $val3=$val1+$val2;                 $name = 'Bar';                        $this->$name(); // This calls the Bar() method     }         function Bar()     {          global $val3;              echo $val3;         echo "This is Bar";     } } $foo = new Foo(); $funcname = "Variable"; ?> [/code] Second [code]<?php class Foo {      function Variable()     {          $val1=1;         $val2=2;         $name = 'Bar';                        $this->$name(); // This calls the Bar() method     }         function Bar()     {          global $val1;         global $val2;         $val3=0;                 $val3=$val1+$val2;                   echo $val3;         echo "This is Bar";     } } $foo = new Foo(); $funcname = "Variable"; ?> [/code]
  3. If i use require or include method to include x.php into y.php, and then i include y.php into z.php, can i make use of the parameter stored in x.php with z.php? Thank you.
  4. [code]$foo=new Foo(); $foo->Variable();[/code] Another problem of the above code is why we must create $foo and actually it defines as the class? Is there any way i can directly use the existing class and call function from there? Thank you.
  5. [code]<?php class Foo {     function Variable()     {         $name = 'Bar';          $this->$name(); // This calls the Bar() method     }         function Bar()     {         echo "This is Bar";     } } $foo = new Foo(); $funcname = "Variable"; $foo->$funcname();  // This calls $foo->Variable() ?> [/code] I tried to add this Foo::Variable(); before ?> and it caused an error. May i know why? If i remove $this->$name(); then the error is fixed. If Foo::Variable(); can call the function directly, why we need to code like this: $foo = new Foo(); $funcname = "Variable"; $foo->$funcname();  // This calls $foo->Variable() What is the difference? Thank you.
  6. What i want to ask is how can CUSTOMER be valid since i can't any assignment on CUSTOMER like LABEL. Thank you.
  7. [quote]<?php class A {   private $var;   public function getVar()   {     return $this->var;   } } ?> It can also be used to call a function in the same class with same syntax.  Say you have a function called setVar that needs to be called internally, you could do $this->setVar(); This is a very brief rundown but I hope it helps, Dest[/quote] Then may i know what is the usage of private under a class and the meaning of public and non public function. Thank you.
  8. May i know when to use global, when to use var? If let say i require x.php file into y.php file by using require syntax, and want to use the variable in the x.php file, do i have to declare again in y.php file or i can directly make use of it and then value can be passed from x.php to y.php? Thank you
  9. func->x May i know that whether the -> is used to call the x, which is a function or parameter or object belong a func, which is a class or function? Please correct if i am wrong. Thank you.
  10. Sorry for asking a beginner question, may i know $this can be only used under class, then can you guys explain $this in an easier way to a beginner like me? If possible, you guys may explain based on a simple example. Thank you for your help.
  11. I have one customer.php file and i use it to call the customer.html file which consist of the following lines, <td valign=TOP style="padding:0px 3px 0px 3px;" bgcolor="{BG_COLOR}">{LABEL.TITLE}</td> <td valign=TOP style="padding:0px 3px 0px 3px;" bgcolor="{BG_COLOR}">{CUSTOMER.NAME}</td> I can't understand how can the CUSTOMER here be valid, the LABEL is understandable since  $customerform=new XTemplate ('customer.html'); $customerform->assign("LABEL", $label); has been included into customer.php and however i can't find the similar assignment on CUSTOMER. Still the CUSTOMER.NAME can be displayed out properly. Thank you.
  12. Sorry guys, i still can't get it, why we need $xtpl? Can you guys tell me based on your what you understand? Thank you.
  13. When i ran php file stored on the server, the warning message never showed out and however after i downloaded the same php source and executed on my localhost, the warning message came out. So i doubt whether the configuration is done externally but not inside the code because the code must be the same. Thank you.
  14. Jenk, i appreciate your advice and i will fix it. On the other side, i want to know how to hide them, this is for my knowledge purpose.
  15. The warning message is like this: Warning: Division by zero in C:\Apache Group\Apache2\htdocs\customer.php on line 201
  16. I mean is there some way else we can hide the warning message? Thank you.
  17. How to do the configuration to hide the PHP warning message? Thank you.
  18. May i know what is the meaning of the following error? What i did is only insert echo "test" into one function of a class. Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in C:\Apache Group\Apache2\htdocs\customer.php on line 181
  19. Then what does this "$xtpl->" about? Assign("ACCOUNT_ID", $focus->account_id) can be done independently? Thank you.
  20. [quote]No. PHP is a programming language and a web browser can not understand PHP. Browsers can only understand client side languages such as HTML, CSS, Javascript etc.  PHP is used as you said to process user input/to make you site dynamic etc.  If you use PHP you still need to use HTML in order for the browser to display your website when someone goes to it.[/quote] For example, the browser can enter into URL/index.php and from here, we can code everything inside the .php or link with other .php, so why we still need html? Thank you.
  21. I am quite new to PHP, I saw many of PHP examples were coded like this, HTML is used for interface and structure design, PHP is used to process the input and then pass it to HTML and display the output. But can PHP do interface design without HTML help? I mean all the thing just do in PHP without HTML. If it is possible, then why do we follow the standard like that. Thank you.
  22. I mean after i pressed F11, or you may find the click under view menu, the scroll bar disappeared under full screen mode. However i expect it to work like IE. Thank you.
  23. I installed the Opera and when i change the windows mode to full screen, the scroll bar won't show out. But i can scroll the screen using the mouse scroll wheel. Can you guys tell me how to solve this? Thank you.
  24. I just installed Mozilla and Opera and i found that the php site is displayed differently. First, Mozilla caused the improper placement of button and label and Opera caused the disappearance of border of table. However, it works properly without these problems by using IE. May i know how to resolve these? Thank you.
  25. Can you guys identify and explain more to me on that? I have no idea, thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.