Frst foray into PHP _SELF [message #169976] |
Sat, 02 October 2010 17:07 |
Twayne
Messages: 135 Registered: September 2010
Karma:
|
Senior Member |
|
|
Hi All,
Long time no see. Been ill, but back now!
Windows XP SP3+, Local XAMPP with Apache, PHP 5.2.5 .
My query is to find out if the following is OK to do, or could cause
problems. I created it accidentally and when I looked it over, it looks
strange (to me) but it worked at first and now won't work. Specifically. The
original is based on a tutorial but I forget which one now:
=============
....
if (!isset($_POST['submit'])) { // if page wasn't submitted to itself echo
the form.
?>
<html>
<head>
<title>Personal INFO</title>
</head>
<body>
<form method="post" action="<?php echo $PHP_SELF;?>">
....
lots of HTML code
....
</form>
<? php
} else { <---------- My concern is this line considering all the HTML code
between the earlier if statement and here. ----->
# Line 55 indication steady when moving any below.;
echo "Hello, ".$Fname." ".$Lname.".<br />";
....
?>
==================
In other words, I use close PHP tag, do a lot of HTML work, then jump back
into PHP and complete the If statement (specifically the ELSE portion). Is
there anything wrong with doing that?
It's my first try at PHP's _SELF for forms.
It worked a couple times and then just stopped. IE8 and FF's latest. All
testing was done locally as I've done for years now before uploading to the
servers. Oh, and yes, I've tried doing a Restart of Windows.
Why am I doing this? Seems like it would be faster and more efficient.
Yes?
Please, avoid the temptation to advise me about sanitizing and verifyiing,
etc.; I purposely wrote this test file without them to follow the KISS
methodology. Also I'm trying to avoid usiing separate PHP files for doing
the form input data checks because this seems more efficient and probably
faster to execute. Seems kinder to the user, too.
Thanks for any comments or corrections needed. I'm also open to better
methods if there are any. Hope you can understand what I meant above; looks
clear to me<g>!
Regards,
Twayne`
--
Life is the only real counselor; wisdom unfiltered
through personal experience does not become a
part of the moral tissue.
|
|
|