Forms with php

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
XvObiVx
-


Joined: 01 May 2004
Posts: 9

PostPosted: Sun May 02, 2004 10:38 pm    Post subject: Forms with php Reply with quote

Ok, I'm just messing with forms in PHP, and when I try to use the following code:
Code:
Code:

<form method="post" action="<?php echo $PHP_SELF?>">

and when I hit my submit key, the page goes to like iWon and searches for localhost. Any help?

Update:
I kept working at it a little, and by placing "http://<?php echo $PHP_SELF?>"?" in, the browser tried to go to "http:///", and that obviously doesn't work. Is there a place where $PHP_SELF is defined? I can't echo it to the screen.[/u]
Back to top View user's profile Send private message
eznetlinks
-


Joined: 27 Sep 2003
Posts: 144

PostPosted: Mon May 03, 2004 12:51 am    Post subject: Reply with quote

these work:

<form method="post" action="">
<?echo $_SERVER["PHP_SELF"];?>


this works with register_globals=on in your php.ini:

<?echo"$PHP_SELF";?>
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Mon May 03, 2004 1:40 am    Post subject: Reply with quote

Way to do it without using globals:
Code:
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">

_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
XvObiVx
-


Joined: 01 May 2004
Posts: 9

PostPosted: Mon May 03, 2004 8:25 pm    Post subject: Reply with quote

Thanks a lot, it does work! =)
Just wondering, what exactly does including the "$_SERVER" part do?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Mon May 03, 2004 8:42 pm    Post subject: Reply with quote

Its a fix to leave Register Globals
turned off , thats all it does !
Back to top View user's profile Send private message Visit poster's website
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Tue May 04, 2004 1:11 am    Post subject: Reply with quote

To read more about this, go here, and here.
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group