Thanks again Kevin.
I am still troubleshooting this. [size=12pt]Please do not give up on me.[/size]
This is sort of ridiculous.
This is a simple command.
I used this command in another chapter of my life or something similar.
When I ask, please do not give up on me - because I am on a mac !!
I found this by scrutinizing the php.ini.
“If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; http://php.net/auto-detect-line-endings
;auto_detect_line_endings = Off”
- I uncommented this line: ;auto_detect_line_endings = Off
- sudo apachectl restart
- closed and reopened ide netbeans.
- file names2.txt NOT created
- I changed the line to auto_detect_line_endings = On
- sudo apachectl restart
- closed and reopened ide netbeans.
- file names2.txt NOT created
Here is the code and the properties.
properties
projectfolder:/Library/WebServer/Documents/phpWithAlex
sourcefolder:/Library/WebServer/Documents/phpWithAlex
webServer/Documents/phpWithAlex
web root:
configuration
run as: Local Web Site running on local server
project url: http://localhost/phpWithAlex/
index file: index.php
index.php
[php]if ($_POST)
{
$handle =fopen(‘names2.txt’, ‘w’);
fwrite($handle, “{$_POST[‘name’]}”);
}
?>
Name:
[/php]
I type in a name and click on submit.
[php]Not Found
The requested URL /phpWithAlex/names2.txt was not found on this server.[/php]
when I use this command [php]$browser = $_SERVER[“PHP_SELF”];[/php]
in this test file server-path-self.php
[php]<?php
//$browser = $_SERVER[“HTTP_USER_AGENT”];
$browser = $_SERVER[“PHP_SELF”];
echo( “Hello World !\n”); ?>
<?php print("Hello World !\n");?>
<?php print("Hello World !
");?>
You are using the <?php echo($browser);?> web browser.
<?php
if(!$_POST["formName"]){
//switch to html mode to display the form
?>
name:
<?php
}else{
?>
Hello There <?php echo($_POST["formName"]); ?> !
<?php
}
?>
[/php]
[php]Hello World !
Hello World !
Hello World !
You are using the /phpWithAlex/server-php-self.php web browser.
name: [/php]
I hope this email CLARIFIES the problem.
You are probably on a linux server or on a pc but you must have acquaintance or colleagues that know this simple resolution. This has been an obstacle for days. I want to move into using these files with php and mysql.
thanks again. it is saturday but i am on this.
By the Way. This posting system is very nice. Many options and a preview.