GetDotted Domains

Viewing Thread:
"PHP help, if that's quite alright Gun'nor"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 12/08/02 at 16:14
Regular
Posts: 787
I've been trying to make a page with a form that points to a PHP file that updates a variable that is then displayed at the top of the form page - you know, like a bulletin board.

I ripped this code from the Freeola hit counter:

$content = "";
if (!$content) $content = "No content";
if(file_exists($content) == TRUE) {
$update = file($content);
$update = $formtext
} else {
$update = "No content";
}
$fp = fopen($content, "w");
fwrite($fp, $update); echo $update;
?>


Now, I think part of it doesn't work because of the fact that I'm trying to use text instead of integers. Am i right? Am I wrong? You tell me. Please.
Wed 21/08/02 at 16:28
Regular
"Eff, you see, kay?"
Posts: 14,156
I added semicolons, which by there absence was causing parse errors :)
Wed 21/08/02 at 15:51
Regular
"Pouch Ape"
Posts: 14,499
Turbonutter wrote:
> Np, just his code isn't written correctly:
>
>
>
> > //the filename of the file to be updated
> //this file should be on your webspace with permisions set to 777
> $filename="example.data";
>
> if (isset($message))
> {
> $fp=fopen($filename, "a"); //opens the file for appending
> fwrite($fp, $message."
"); //writes the posted
> message to the file
> }
> //includes the file which will be updated
> include($filename);
> ?>
>
> method=post>
>

>
>

>
>

Hang on, did you just type out his code again? I can't see any difference. Come on people, give this to me on a plate!
Wed 21/08/02 at 14:49
Regular
"Eff, you see, kay?"
Posts: 14,156
No*
Wed 21/08/02 at 14:49
Regular
"Eff, you see, kay?"
Posts: 14,156
Np, just his code isn't written correctly:



//the filename of the file to be updated
//this file should be on your webspace with permisions set to 777
$filename="example.data";

if (isset($message))
{
$fp=fopen($filename, "a"); //opens the file for appending
fwrite($fp, $message."
"); //writes the posted message to the file
}
//includes the file which will be updated
include($filename);
?>






Wed 21/08/02 at 09:21
Regular
"Pouch Ape"
Posts: 14,499
Cheers Super_Eggbert, but I get this error message:

Parse error: parse error, unexpected T_STRING in /freeola/users/3/1/sr0199213/htdocs/phptest.php on line 8

Is it something to do with Freeola's permissions?
Wed 21/08/02 at 09:21
Regular
"Pouch Ape"
Posts: 14,499
Cheers Super_Eggbert, but I get this error message:

Parse error: parse error, unexpected T_STRING in /freeola/users/3/1/sr0199213/htdocs/phptest.php on line 8

Is it something to do with Freeola's permissions?
Wed 21/08/02 at 09:19
Regular
"Pouch Ape"
Posts: 14,499
Cheers Super_Eggbert, but I get this error message:

Parse error: parse error, unexpected T_STRING in /freeola/users/3/1/sr0199213/htdocs/phptest.php on line 8

Is it something to do with Freeola's permissions?
Tue 20/08/02 at 20:00
Posts: 0
The following example should help you in your quest



//the filename of the file to be updated
//this file should be on your webspace with permisions set to 777
$filename="example.data";

if (isset($message))
{
$fp=fopen($filename, "a") //opens the file for appending
fwrite($fp, $message."
") //writes the posted message to the file
}
//includes the file which will be updated
include($filename);
?>






Mon 12/08/02 at 23:05
Posts: 0
monkey_man wrote:
> I've been trying to make a page with a form that points to a PHP file
> that updates a variable that is then displayed at the top of the form
> page - you know, like a bulletin board.

Tell me exactly what you want the script to do (e.g. what type of variable - numerical or string?) and I will give you the script for it.
Mon 12/08/02 at 22:49
Regular
"Eff, you see, kay?"
Posts: 14,156
$content = ""; // this would be the file name?
if (!$content): $content = "No content"; endif;
if(file_exists($content) == TRUE) {
$update = file($content); // get the number of hits from the file...
$update = $formtext; // ...and overwrite it???
} else {
$update = "No content";
}
$fp = fopen($content, "w"); // ???
fwrite($fp, $update); // ???
echo $update;
?>

I think your script is screwed. I understand a code but it doesn't seem to do anything useful :-)

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Excellent
Excellent communication, polite and courteous staff - I was dealt with professionally. 10/10
Second to none...
So far the services you provide are second to none. Keep up the good work.
Andy

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.