RE: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 06 December 2004 17:23, Greg Donald wrote:

> On Mon, 06 Dec 2004 11:54:50 -0500, Robert Sossomon
> <[EMAIL PROTECTED]> wrote:
> > Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> > c:\fourh\leadership\registration_post.php on line 29
> > 
> > for ($i=0; $i < count($choices); $i++)
> 
> This is bad.  Every time the for() loop iterates, the count() function
> gets called again unnecessarily.  Better to do:
> 
> $count = count( $choices );
> for ($i=0; $i < $count; $i++)

You can even do (keeping all the loop-related stuff within the for( )
construct):

   for ($i=0, $count=count($choices); $i < $count; $i++)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread Greg Donald
On Mon, 06 Dec 2004 11:54:50 -0500, Robert Sossomon
<[EMAIL PROTECTED]> wrote:
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> c:\fourh\leadership\registration_post.php on line 29
> 
> for ($i=0; $i < count($choices); $i++)

This is bad.  Every time the for() loop iterates, the count() function
gets called again unnecessarily.  Better to do:

$count = count( $choices );
for ($i=0; $i < $count; $i++)

> {
>   $value = $choices[$i];
>   $tempChoice = "choice" . $j;
>   $$tempChoice = $value;
>   $j++;
> }
> 
> $0405distoffice= $_POST['04_05_dist_office'];  //line29

Variables can contain numbers, but the first character after the $
must not be one.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread Richard Lynch
Variable names cannot start with a digit.

$distoffice0405 is kosher.
$0405distoffice is not.

Robert Sossomon wrote:
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> c:\fourh\leadership\registration_post.php on line 29
>
> The HTML page:
> http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php
>
> The processing Script
> 
>
> 
> $fname= $_POST[fname];
> $lname= $_POST[lname];
> $addie= $_POST[addie];
> $city= $_POST[city];
> $state= $_POST[state];
> $zip= $_POST[zip];
> $county= $_POST[county];
> $dphone= $_POST[dphone];
> $ephone= $_POST[ephone];
> $email= $_POST[email];
> $first_conf= $_POST[first_conf];
> $payment= $_POST[payment];
> $PreConference= $_POST['PreConference'];
> $Conference= $_POST['Conference'];
>
> $choices = $_POST['choice'];
> array_splice($choices,4);
> $j=1;
> for ($i=0; $i < count($choices); $i++)
> {
>   $value = $choices[$i];
>   $tempChoice = "choice" . $j;
>   $$tempChoice = $value;
>   $j++;
> }
>
> $0405distoffice= $_POST['04_05_dist_office'];  //line29
> $0506distoffice= $_POST['05_06_dist_office'];
> $former= $_POST[former];
> $achieve= $_POST[achieve];
>
>
> ?>
> 
>
> I pulled out the iterations above that line of code and tested it
> separately.
> Everything worked OK, so I copied it into the rest of the PHP processing.
>
> This thing is driving me bonkers.  Any suggestions?
>
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 200 Ricks Hall, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax:   919/515-7812
> [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread John Holmes
Robert Sossomon wrote:
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in 
c:\fourh\leadership\registration_post.php on line 29
[snip]
$0405distoffice= $_POST['04_05_dist_office'];  //line29
$0506distoffice= $_POST['05_06_dist_office'];
Variable names cannot start with a number.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread John Nichel
Robert Sossomon wrote:
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in 
c:\fourh\leadership\registration_post.php on line 29

$0405distoffice= $_POST['04_05_dist_office'];  //line29
$0506distoffice= $_POST['05_06_dist_office'];

Look in the manual, that's your first stop...
http://us4.php.net/manual/en/language.variables.php
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread Thomas Munz
you forgot the " ' " in the 


$fname= $_POST[fname];
$lname= $_POST[lname];
$addie= $_POST[addie];
$city= $_POST[city];

fields!!!

> error, expecting `T_VARIABLE' or `'$'' in 
> c:\fourh\leadership\registration_post.php on line 29
>
> The HTML page:
> http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php
>
> The processing Script
> 
>
> 
> $fname= $_POST[fname];
> $lname= $_POST[lname];
> $addie= $_POST[addie];
> $city= $_POST[city];
> $state= $_POST[state];
> $zip= $_POST[zip];
> $county= $_POST[county];
> $dphone= $_POST[dphone];
> $ephone= $_POST[ephone];
> $email= $_POST[email];
> $first_conf= $_POST[first_conf];
> $payment= $_POST[payment];
> $PreConference= $_POST['PreConference'];
> $Conference= $_POST['Conference'];
>
> $choices = $_POST['choice'];
> array_splice($choices,4);
> $j=1;
> for ($i=0; $i < count($choices); $i++)
> {
>   $value = $choices[$i];
>   $tempChoice = "choice" . $j;
>   $$tempChoice = $value;
>   $j++;
> }
>
> $0405distoffice= $_POST['04_05_dist_office'];  //line29
> $0506distoffice= $_POST['05_06_dist_office'];
> $former= $_POST[former];
> $achieve= $_POST[achieve];
>
>
> ?>
> 
>
> I pulled out the iterations above that line of code and tested it
> separately. Everything worked OK, so I copied it into the rest of the PHP
> processing.
>
> This thing is driving me bonkers.  Any suggestions?
>
> --
> Robert Sossomon, Business and Technology Application Technician
> 4-H Youth Development Department
> 200 Ricks Hall, Campus Box 7606
> N.C. State University
> Raleigh NC 27695-7606
> Phone: 919/515-8474
> Fax:   919/515-7812
> [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PARSE ERROR, unexpected T_$VARIABLE

2004-12-06 Thread Robert Sossomon
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in 
c:\fourh\leadership\registration_post.php on line 29

The HTML page:
http://rsossam-lap.ces.ncsu.edu/leadership/registration2.php
The processing Script


$fname= $_POST[fname];
$lname= $_POST[lname];
$addie= $_POST[addie];
$city= $_POST[city];
$state= $_POST[state];
$zip= $_POST[zip];
$county= $_POST[county];
$dphone= $_POST[dphone];
$ephone= $_POST[ephone];
$email= $_POST[email];
$first_conf= $_POST[first_conf];
$payment= $_POST[payment];
$PreConference= $_POST['PreConference'];
$Conference= $_POST['Conference'];
$choices = $_POST['choice'];
array_splice($choices,4);
$j=1;
for ($i=0; $i < count($choices); $i++)
{
 $value = $choices[$i];
 $tempChoice = "choice" . $j;
 $$tempChoice = $value;
 $j++;
}
$0405distoffice= $_POST['04_05_dist_office'];  //line29
$0506distoffice= $_POST['05_06_dist_office'];
$former= $_POST[former];
$achieve= $_POST[achieve];
?>

I pulled out the iterations above that line of code and tested it separately. 
Everything worked OK, so I copied it into the rest of the PHP processing.

This thing is driving me bonkers.  Any suggestions?
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php