Notice: Undefined index: company_body ... on line 9
Warning: fopen(777) [function.fopen]: failed to open stream: Permission denied ... on line 11
can't open file
Lol same thing. Chmoding? Maybe I misunderstood?
Using fwrite with $_POST variables
Moderator: General Moderators
-
Damian2020
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 20, 2009 5:25 am
Re: Using fwrite with $_POST variables
No, chmod the file to 777. Are you on windows or *nix? And are you doing this over ftp?
-
Damian2020
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 20, 2009 5:25 am
Re: Using fwrite with $_POST variables
I'm on Windows, FTP yes.
chmod?
chmod?
Re: Using fwrite with $_POST variables
Your server is running windows? Windows default permissions should allow you to write to the file...
In your FTP client, if you right click the file, do you see "chmod" or "permissions" or something?
In your FTP client, if you right click the file, do you see "chmod" or "permissions" or something?
-
Damian2020
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 20, 2009 5:25 am
Re: Using fwrite with $_POST variables
Ok I see what you mean. I've enabled all of the write permissions and it's now set to 777.
I'm still getting this message:
Notice: Undefined index: company_body in ... file.php on line 9
My PHP code currently looks like this:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
//if ($_POST['sendRequest'] == "update_company_page") { // commented out
$company_body = $_REQUEST['company_body'];
$companyFile = "company.txt";
$companyFh = fopen($companyFile, 'w') or die("can't open file");
$companyString = $company_body;
fwrite($companyFh, $companyString);
fclose($companyFh);
?>
I'm still getting this message:
Notice: Undefined index: company_body in ... file.php on line 9
My PHP code currently looks like this:
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
//if ($_POST['sendRequest'] == "update_company_page") { // commented out
$company_body = $_REQUEST['company_body'];
$companyFile = "company.txt";
$companyFh = fopen($companyFile, 'w') or die("can't open file");
$companyString = $company_body;
fwrite($companyFh, $companyString);
fclose($companyFh);
?>
-
Damian2020
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 20, 2009 5:25 am
Re: Using fwrite with $_POST variables
I've managed to write the file using a simple string. So it definately works.
It seems the problem lies with getting the $_POST data into the fwrite function.
Is there a way to convert the data to a string maybe? What I've done obviously doesn't work $companyString = $company_body in fact I think it's probably redundant.
It seems the problem lies with getting the $_POST data into the fwrite function.
Is there a way to convert the data to a string maybe? What I've done obviously doesn't work $companyString = $company_body in fact I think it's probably redundant.
Re: Using fwrite with $_POST variables
Are you running this from flash now?