Connecting Tech Pros Worldwide Forums | Help | Site Map

parse error

new kid
Guest
 
Posts: n/a
#1: Jul 17 '05

hi,

i am new to php programming.i am getting a parse error in
configuratuion file of the web site which i am designing ,i.e(th file
in which u specify the paths to various folders like folder where
uploaded files r stored etc).This is occuring when i click login button
after typing the username and password in the login page. the line of
error is

// Location of files for committee members
$files_members = 'c:\bbn\committee_review\';


the login page is,

<?php

// User Login
include_once('bbn_header.php');

if(!isset($_POST['username']) || !isset($_POST['pass']))
{
include_once('bbn_header.php');
echo "<form enctype=\"application/x-www-form-urlencoded\"
action=\"login.php\" method=\"POST\" name=\"file_form\">\r\n";
echo "<p><b>Username:</b><br>\r\n";
echo "<input type=\"text\" name=\"username\" size=25
maxlength=35>\r\n";
echo "</p>\r\n";

echo "<p><b>Password:</b><br>\r\n";
echo "<input type=\"PASSWORD\" name=\"pass\" size=16
maxlength=16>\r\n";
echo "</p>\r\n";
echo "<input type=\"submit\" name=\"submit\" value=\"Login\">\r\n";
echo "<input type=\"reset\" name=\"clear\" value=\"Clear form\">\r\n";
}
else
{

include_once('includes_path.php');
include_once($bbn_includes_path.'authentication.ph p');

}

include_once('bbn_footer.php');

?>


Ken Robinson
Guest
 
Posts: n/a
#2: Jul 17 '05

re: parse error



new kid wrote (in part):
[color=blue]
> i am new to php programming.i am getting a parse error in
> configuratuion file of the web site which i am designing ,i.e(th file
> in which u specify the paths to various folders like folder where
> uploaded files r stored etc).This is occuring when i click login[/color]
button[color=blue]
> after typing the username and password in the login page. the line of
> error is
>
> // Location of files for committee members
> $files_members = 'c:\bbn\committee_review\';
>[/color]

Can you post the last few lines above the lines you posted? The line
where PHP reported the parse error is just where it finally said to
itself "I can't figure out what I'm supposed to do anymore". Usually a
line or two above, there is a missing closing quote, no semi-colon, a
missing closing ")" or "}".
[color=blue]
>
> the login page is,
>
> <?php
>
> // User Login
> include_once('bbn_header.php');
>
> if(!isset($_POST['username']) || !isset($_POST['pass']))
> {
> include_once('bbn_header.php');
> echo "<form enctype=\"application/x-www-form-urlencoded\"
> action=\"login.php\" method=\"POST\" name=\"file_form\">\r\n";
> echo "<p><b>Username:</b><br>\r\n";
> echo "<input type=\"text\" name=\"username\" size=25
> maxlength=35>\r\n";
> echo "</p>\r\n";
>
> echo "<p><b>Password:</b><br>\r\n";
> echo "<input type=\"PASSWORD\" name=\"pass\" size=16
> maxlength=16>\r\n";
> echo "</p>\r\n";
> echo "<input type=\"submit\" name=\"submit\" value=\"Login\">\r\n";
> echo "<input type=\"reset\" name=\"clear\" value=\"Clear[/color]
form\">\r\n";

A note on your coding style. Your code will be much easier to read if
you use single quotes to enclode strings that include double quotes.
Then you won't have to escape the double quotes. For example, you have:

echo "<form enctype=\"application/x-www-form-urlencoded\"
action=\"login.php\" method=\"POST\" name=\"file_form\">\r\n";

That can be changed to:

echo '<form enctype="application/x-www-form-urlencoded"
action="login.php" method="POST" name="file_form">'."\r\n";

Which is much easier on the eyes. The '\r\n' need to be in double
quotes or they won't be converted to the correct ASCII characters.

Ken

Alvaro G. Vicario
Guest
 
Posts: n/a
#3: Jul 17 '05

re: parse error


*** new kid escribió/wrote (11 Feb 2005 11:15:37 -0800):[color=blue]
> $files_members = 'c:\bbn\committee_review\';[/color]

The back-slash character (\) is a escape character with a special meaning.
For instance, you use it to insert single quotes inside a single quiote
delimited string:

$foo='Patrick O\'Brian';

Got a clue now? :)

http://www.php.net/manual/en/language.types.string.php


--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Closed Thread