FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Frst foray into PHP _SELF
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Frst foray into PHP _SELF [message #169977 is a reply to message #169976] Sat, 02 October 2010 17:27 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/2/2010 1:07 PM, Twayne wrote:
> 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?

Sure, nothing wrong with it at all. But what does this question have to
do with PHP_SELF?

> 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?
>

Sure, it's not at all uncommon to have html within a PHP conditional.

If it's not working, enable all error processing and display your
errors. And make sure you display the page source from your browser to
catch any invalid html the browser may not be displaying.


> 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`
>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problems modifying date using regex
Next Topic: Is PHP solution for web scripts?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 15:03:18 GMT 2024

Total time taken to generate the page: 0.03605 seconds