Re: im so stupid
| From: | Nicole Amashta | Date: | Mon, 11 Feb 2002 18:17:54 +0000 |
| Subject: | Re: im so stupid | ||
| References: | 1 2 3 4 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11987@lists.php.net to get a copy of this message | ||
Separating code from HTML has it's purpose and it's not performance related.
It has to do with maintaining code and separating that from the WYSIWYG
design.
Who wants to worry about what the page is gonna look like versus what the
functionality will be to handle the page?
PHPLib templates is a good way to do this.
Intermixing code and HTML is sloppy - unless you just want to maintain job
security. Heh.
Basically it's for maintainability. It's best suited for running large
sites. You can change the look and feel of a site at anytime without
breaking the actual code.
Just my 2 cents worth.
;)=
Nicole Amashta
www.aeontrek.com
==============
"Mike Flynn" <mike@mikeflynn.net> wrote in message
news:5.1.0.14.2.20020211121942.00acd010@mikeflynn.net...
> Yeah, Afan, I prefer to do everything in one file as well. I think
> separating the HTML from the PHP is silly, barring minute performance
> improvements. If there was a page with a form that lot's of people would
> see but few people would submit, then I could understand it. But for a
> form page that is usually going to get submitted, I think it makes the
most
> sense to include the PHP in the same file as the HTML. It eliminates HTML
> code redundancy, makes coding it easier and more logical, and allows you
to
> integrate the dynamic elements in with the static elements.
>
> I always do my pages in straight PHP. Granted, if I worked for Google or
> MSN or some huge site, they probably wouldn't want me to do it. But for
> any non-huge site the speed difference is going to be negligible.
>
> -Mike
>
> At 12:15 PM 2/11/2002 -0500, Afan Pasalic wrote:
> >Yes Todd, you're right. It looks now much better, but I just pointed to
> >Chris what could solve the problem...
> >Actually, I would rather do that everything in one file:
> >
> >
> ><?php if($submit) { $db = MSSQL_CONNECT($hostname,$username,$password);
> >mssql_select_db($dbname); $sql = "insert into studenter(fornavn,
> >etternavn) values ('$fornavn','$etternavn')"; $result =
> >mssql_query($sql,
> >$db); echo"
> >
> >You have successfully entered the following information $fornavn
> >$etternavn
> >
> >
> >
> >"; } else { ?> Fornavn:
> >Etternavn:
> >
> ><?php } ?>
> >
> >Right?
> >
> >Afan
> >
> >
> >----- Original Message -----
> >From: Todd Williamsen
> >To: php-windows@lists.php.net
> >Sent: Monday, February 11, 2002 11:51 AM
> >Subject: Re: [PHP-WIN] im so stupid
> >
> >
> >Afan...
> >
> >First off, to make things easier and since you are calling register.php
in
> >your form...
> >
> >Just make a plain HTML page like this and name it whatever the hell you
want
> >
> >Fornavn:
> >Etternavn:
> >
> >
> >Then make your registrer.php page:
> >
> >
> >$db = MSSQL_CONNECT($hostname,$username,$password);
> >mssql_select_db($dbname);
> >$sql = "insert into studenter(fornavn, etternavn) values
> >('$fornavn','$etternavn')";
> >$result = mssql_query($sql, $db);
> >
> >
> >
> >You have successfully entered the following information <? echo "$fornavn
> >$etternavn"; ?>
> >
> >
> >
> >
> >
> >
> >"Afan Pasalic" <afan@sprout.net> wrote in message
> >news:005601c1b310$fa19ad80$311f49d1@VAIO...
> >Try this:
> >
> >$db = MSSQL_CONNECT($hostname,$username,$password);
> >mssql_select_db($dbname);
> >$sql = "insert into studenter(fornavn, etternavn) values
> >('$fornavn','$etternavn')";
> >$result = mssql_query($sql, $db);
> >
> >
> >Afan
> >
> >
> >
> > ----- Original Message -----
> > From: chris
> > To: php-windows@lists.php.net
> > Sent: Monday, February 11, 2002 6:10 AM
> > Subject: [PHP-WIN] im so stupid
> >
> >
> > I have made a script and for some reason i dont understand it doesnt
do
> >what
> > its supposed to. maybe you can tell me whats wrong. its a form where
im
> > supposed to insert a new record in a mssql table. but when i hit
submit it
> > just refreshes blank.
> >
> > <html>
> > <head></head>
> > <body><form method="post" action="registrer.php">
> > Fornavn: <input type="text" name="fornavn"><br>
> > Etternavn: <input type="text" name="etternavn"><br>
> > <input type="Submit" name="submit"
> > value="Registrer"><br> </form>
> > <?
> > IF (isset($submit))
> > {
> > $hostname = "dbname";
> > $username = "chris";
> > $password = "*****";
> > $dbname = "chris";
> > MSSQL_CONNECT($hostname,$username,$password);
> > mssql_select_db($dbname);
> > $sql = "insert into studenter(fornavn, etternavn) values
> > ('$fornavn','$etternavn')";
> > $result = mssql_query($sql);
> > $studentnummer = mssql_insert_id();
> > Print("Studenten er lagt inn!");
> > }
> > ?>
> > </body>
> > </html>
>
> -=- Mike Flynn - Burlington, VT -=-
> mike@mikeflynn.net http://www.mikeflynn.net/ * Give blood *
> ...maintaining lawns, watching televised sports, birthing
> children, listening to Top 40 music, and collecting
> stuffed animals...
>