View previous topic :: View next topic |
Author |
Message |
XvObiVx -
Joined: 01 May 2004 Posts: 9
|
Posted: Sun May 02, 2004 10:38 pm Post subject: Forms with php |
|
|
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 |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Mon May 03, 2004 12:51 am Post subject: |
|
|
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 |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Mon May 03, 2004 1:40 am Post subject: |
|
|
Way to do it without using globals:
Code: | <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> |
_________________ Bienvenidos! |
|
Back to top |
 |
 |
XvObiVx -
Joined: 01 May 2004 Posts: 9
|
Posted: Mon May 03, 2004 8:25 pm Post subject: |
|
|
Thanks a lot, it does work! =)
Just wondering, what exactly does including the "$_SERVER" part do? |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon May 03, 2004 8:42 pm Post subject: |
|
|
Its a fix to leave Register Globals
turned off , thats all it does ! |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue May 04, 2004 1:11 am Post subject: |
|
|
To read more about this, go here, and here. _________________ Bienvenidos! |
|
Back to top |
 |
 |
|