parse error in submit.php on line 10

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Mactek
Forum Commoner
Posts: 28
Joined: Tue Oct 28, 2003 1:19 pm
Location: Boston

Post by Mactek »

I copy and pasted the code and i am also getting a parse error on line 9.
OuchMedia
Forum Newbie
Posts: 11
Joined: Mon Nov 24, 2003 10:48 pm

Post by OuchMedia »

The parse error is gone but now there are new errors...they are as follows:

Warning: fopen("/quotes.txt","a") - Permission denied in /home/sites/site46/web/New/submit.php on line 21

Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site46/web/New/submit.php on line 23

Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site46/web/New/submit.php on line 24

here is the script exactly as it appears:


<html>
<head>
<title>Untitled Document</title>
</head>
<body>

Code: Select all

<?php 

//Define your variables here 
$date = $_POST['name']; 
$name = $_POST['title']; 
$company = $_POST['company']; 
$address = $_POST['address']; 
$location = $_POST['location']; 
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone']; 
$email = $_POST['email']; 
$description = $_POST['description']; 
//The above define your variables sent from your "form.php" file 

$fp = fopen("$/quotes.txt", "a"); 
$outputstring = "$date.\n\r\r. Name .$name.\n\r\r Title $title.\n\r\r Company $company.\n\r\r Address $address.\n\r\r City, State $location.\n\r\r Phone $phone.\n\r\r Phone $phone.\n\r\r Email $email.\n\r\r Text $description.\n\r\r"; 
fwrite($fp, $outputstring); 
fclose($fp); 
?>
<h1>ouch media</h1>
<h2>form results</h2>

Code: Select all

<? 
echo "<p>form processed."; 
?>

</body>
</html>

Thanks for the help thus far.

*****here is some info from the "support" section of my host for my server:

What paths do I need to know in order to configure my cgi scripts?

The path to date: /usr/bin/date
The path to perl: /usr/bin/perl
The path to sendmail: /usr/sbin/sendmail
The path to your site: /home/sites/www.yourdomain.com/web
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

The error has to do with this line:

Code: Select all

$fp = fopen("$/quotes.txt", "a");
Where do you want quotes.txt to be? If it is supposed to be in the same folder as this script you should change that line to:

Code: Select all

$fp = fopen("quotes.txt", "a");
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Topic continued:
viewtopic.php?t=14977

Mac
Locked