Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.php > #3228 > unrolled thread
| Started by | robamman2020@hotmail.com |
|---|---|
| First post | 2020-03-16 04:38 -0700 |
| Last post | 2020-03-19 10:02 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to alt.php
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: New to OOP in PHP robamman2020@hotmail.com - 2020-03-16 04:38 -0700
Re: New to OOP in PHP Allodoxaphobia <trepidation@example.net> - 2020-03-17 16:26 +0000
Re: New to OOP in PHP Kristjan Robam <robamman2020@hotmail.com> - 2020-03-19 10:02 -0700
| From | robamman2020@hotmail.com |
|---|---|
| Date | 2020-03-16 04:38 -0700 |
| Subject | Re: New to OOP in PHP |
| Message-ID | <7d127fd5-a2da-4ce0-aff2-19409161008d@googlegroups.com> |
Your code seems interesting...
Kristjan Robam
laupäev, 22. oktoober 2011 13:17.10 UTC+3 kirjutas Karl-Arne Gjersøyen:
> Hello.
> I am new to OOP in PHP and am trying to lear me how to create classes
> with property and methods in class files. Then include them in an
> ordinary php file and use instance to create objects.
>
> I have in my class file a property with default value. It is some
> XHTML code. But I can't fine the reasons for why it not can be
> displayed.
> Here is my files.
> First the ordinary PHP file with instance
>
> (my_form.php)
> ---------------------
> <?php
> include('class_my_form.php');
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no">
> <head>
> <meta http-equiv="content-type" content="application/xhtml+xml;
> charset=utf-8" />
> <title>My Form</title>
> <meta name="generator" content="BBEdit 10.1" />
> </head>
> <body>
> <h1>My Form</h1>
> <?php
> // Print form
> // First get a new object
> $myForm = new feedback();
> // Save the Form code
> $myForm->setHtml($form);
> echo $myForm->Html;
>
>
> //$name = "Karl-Arne";
>
> // Create a new object
> $n = new feedback($name);
> // Save $name into $n->Name
> $n->setName($name);
>
> // Print to screen
> echo $n->Name;
>
> ?>
> </body>
> </html>
>
>
> And here is my class file
> (class_my_form.php)
> <?php
> class feedback{
> // Properties
> private $name;
> private $email;
> private $subject;
> private $message;
> private $form = <<<HTML
> <form action="my_form.php" method="post">
> <p>
> Name:<br />
> <input type="text" name="name" />
> </p>
> <p>
> <input type="submit" name="submit" value="Submit" />
> </p>
> </form>
> HTML
> ;
>
>
> // Methods
> // Form
> public function setHtml($form){
> $this->Html = $form;
> }
> function getHtml(){
> return $this->Html;
> }
>
> // Name
> public function setName($name){
> $this->Name = $name;
> }
> public function getName(){
> return $this->Name;
> }
> }
> ?>
>
> Can somebody explain what I am doing wrong here? I have try to use
> var_dump() but it did not return anything to me.
>
> Thanks.
> Karl
[toc] | [next] | [standalone]
| From | Allodoxaphobia <trepidation@example.net> |
|---|---|
| Date | 2020-03-17 16:26 +0000 |
| Message-ID | <slrnr71uhc.4co.trepidation@vps.jonz.net> |
| In reply to | #3228 |
On Mon, 16 Mar 2020 04:38:21 -0700 (PDT), robamman2020@hotmail.com wrote: > laupäev, 22. oktoober 2011 13:17.10 UTC+3 kirjutas Karl-Arne Gjersøyen: >> Hello. >> I am new to OOP in PHP and am trying to lear me how to create classes > > Your code seems interesting... > > Kristjan Robam Why the hell are you replying to 5, 6, 7, and 9 year old posts? Oh, I see. It's a google grooper bored in self quarantine. (top posting corrected)
[toc] | [prev] | [next] | [standalone]
| From | Kristjan Robam <robamman2020@hotmail.com> |
|---|---|
| Date | 2020-03-19 10:02 -0700 |
| Message-ID | <51ff38cf-702f-436b-b981-88546ab589d7@googlegroups.com> |
| In reply to | #3230 |
teisipäev, 17. märts 2020 18:26.22 UTC+2 kirjutas Allodoxaphobia: > On Mon, 16 Mar 2020 04:38:21 -0700 (PDT), robamman2020@hotmail.com wrote: > > laupäev, 22. oktoober 2011 13:17.10 UTC+3 kirjutas Karl-Arne Gjersøyen: > >> Hello. > >> I am new to OOP in PHP and am trying to lear me how to create classes > > > > Your code seems interesting... > > > > Kristjan Robam > > Why the hell are you replying to 5, 6, 7, and 9 year old posts? > > Oh, I see. It's a google grooper bored in self quarantine. > > (top posting corrected) I found something interesting for me .... To be exact, this part: "private $form = <<<HTML <form" With best wishes, Kristjan Robam
[toc] | [prev] | [standalone]
Back to top | Article view | alt.php
csiph-web