Jump to content

<?=$_SERVER['PHP_SELF']?> on MAMP is not working


simpli

Recommended Posts

Hi,

I have the script below and it is now working. The $_SERVER... is supposed to refer to the current page but all I get is the below error message from firefox? Can anyone give me a hint of a solution?

Thank you kindly.

J-R

 

The error message is as below:

Firefox can't find the file at /Applications/MAMP/htdocs/pool/<?=$_SERVER['PHP_SELF']?>.

 

 

This is my script.

<?php

 

if(isset($_POST['Login']))

{

' if($_POST['username']!='' && $_POST['password']!='')'

' {'

' echo " utilisateur actuel"'

' }'

}

else{

if(isset($_POST['CreateUser']))

{

echo "Nouvel utilisateur"

}

}

 

?>

 

<?php if(isset($error)){ echo $error;}?>

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

<input type="text" id="username" name="username" size="32" value="" />

<input type="password" id="password" name="password" size="32" value="" />

<input type="submit" name="Login" value="Login" />

<input type="submit" name="New account" value="CreateUser" />

 

</form>

Link to comment
https://forums.phpfreaks.com/topic/144710-on-mamp-is-not-working/
Share on other sites

Hi,

and thank you very much for your very fast reply. I tried to do the change you suggested. So far it's not working. Right now I have removed everything in the php file except for that little piece.

 

Could this be a configuration issue? Thanks for your continued help. J-R

 

I still get the same error message:

Firefox can't find the file at /Applications/MAMP/htdocs/pool/<? php=$_SERVER['PHP_SELF']?>.

 

Here is my code, to its simplest expression.

<form action="<? php=$_SERVER['PHP_SELF']?>" method="post">

<input type="text" id="username" name="username" size="32" value="" />

<input type="password" id="password" name="password" size="32" value="" />

<input type="submit" name="Login" value="Login" />

<input type="submit" name="New account" value="CreateUser" />

 

</form>

Hi again,

it's still not working.

Here's how I set it up.

 

<?php if(isset($error)){ echo $error;}?>

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

<input type="submit" name="Login" value="Login" />

<input type="submit" name="New account" value="CreateUser" />

 

</form>

 

Do you think it would be possible for you to put a complete implementation of that command so I could try it on my end. What you have above is absolutely ALL there is in my php file. I am fairly new to php so I'm going through a brutal learning curve. Thanks again for your help.

J-R

I got the error. I am going through MAMP to test and when going through MAMP you must use

http://localhost:8888/MAMP/ as the root. Also your files must be placed in that directory and be resolved accordingly. When I was testing I just opened the file in the browser but that didnt work. I have to have the http://localhost:8888/MAMP/ at the beginning of the adress or it wouldnt work.

 

Anyway thanks,

J-R

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.