Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Error processing text ...
Can some please help me. I want this script to save my textbox input
from the form to the file about.txt ... For some reason it wont work
and I am .

//////////////////////////////////////
saveAbout.php
//////////////////////////////////////

<?php

$fp = @fopen("about.txt", "rb") or die("Couldn't open file");
$data = fread($fp, filesize($fp));

while(!feof($fp))
{
$data .= fgets($fp, 1024);
}

fclose($fp);

$values = explode("\r\n", $data);

echo . $values[0] . " " . $values[1] . "<br>";

?>

//////////////////////////////////////
formAbout.html
//////////////////////////////////////

<html>
<head>
<title> About Us Editor </title>
</head>
<body bgcolor="#ffffff">
<form action="saveAbout.php" method="post">
Edit the topic in the box below :
<p>&nbsp;&nbsp;&nbsp; <textarea rows="15" name="S1" cols="57">
</textarea>
<br>
<br>
<input type="submit" value="Save Data >>">
</p>
</form>
</body>
</html>

//////////////////////////////////////
Thanks in advance

- Adam

Report this thread to moderator Post Follow-up to this message
Old Post
Adam Rumpke
03-27-04 04:12 AM


Re: Error processing text ...
"Adam Rumpke" <goldstonrumpke@hotmail.com> wrote in message
news:13c3ff37.0403220212.5fecec49@posting.google.com...
> Can some please help me.
>

Please stop cross-posting to inappropriate groups. I've tried to be nice so
far, but PHP has nothing to do with Perl and vice-versa. Also note that php
is *not* a top level usenet group, hence there will never be a
"php.general".

Matt



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Garrish
03-27-04 04:12 AM


Re: Error processing text ...
Adam Rumpke wrote:
> Can some please help me. I want this script to save my textbox input
> from the form to the file about.txt ... For some reason it wont work
> and I am .

Well, it is full of syntax errors to begin with.
Not to mention that you are missing

use strict;
use warnings;

> $fp = @fopen("about.txt", "rb") or die("Couldn't open file");

If you want to index an array you should use square brackets.
If the @fopen("about.txt", "rb") is meant to open a file about.txt, then
maybe you meant something like
open (FH, ">about.txt");
However it is hard to tell what you are trying to accomplish because the
syntax only very vaguly resembles Perl.

> $data = fread($fp, filesize($fp));

Where is fread() defined?
Did you mean read() (unlikely) or simply <FH>?

> while(!feof($fp))

Where is feof() defined?

[rest of bogus 'code' snipped]

Well, you know, you really should get a book about learning Perl,
familiarize yourself with the basic syntax, and try some programs on the
"Hello World" level before venturing into more elaborate areas. Your program
is so hopelessly broken, I would just throw it away and start from scratch
anew.

jue



Report this thread to moderator Post Follow-up to this message
Old Post
Jürgen Exner
03-27-04 04:12 AM


Re: Error processing text ...
> Well, you know, you really should get a book about learning Perl,
> familiarize yourself with the basic syntax, and try some programs on the
> "Hello World" level before venturing into more elaborate areas. Your
program
> is so hopelessly broken, I would just throw it away and start from scratch

You do realize he's asking a PHP question right? He prolly crossposted to
your perl group by accident.



Report this thread to moderator Post Follow-up to this message
Old Post
muis
03-27-04 04:12 AM


Re: Error processing text ...
Actually the code seems to work -> I tried it on Linux and it worked
once I chmod 777 the files. Thanks for your help though. Would anyone
know how to work around the chmod issue on Windows? Seems like this
issue is windows :)

Thanks

- Adam

Report this thread to moderator Post Follow-up to this message
Old Post
Adam Rumpke
03-27-04 04:13 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:56 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.