Forum Moderators: coopster

Message Too Old, No Replies

Parse error when confirmation of form submission

Unexpected T_STRING; Using Phorm

         

LABachlr

4:44 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



I am using Phorm to process an submission form. When the form is "submitted" and it goes to the confirmation page (generic.html), I'm getting the following error:

Parse error: parse error, unexpected T_STRING in /home/neimanre/public_html/procs/lib/functions.php(173) : eval()'d code on line 1

Not sure what the 173 means.

I'm assuming it means the line number. So, here is the code. 173 is the second from the bottom.

}
else {
if ($ph_debug36)
echo "<B>VarSub@".(__LINE__ + 1)."</B> \$ph_SubVal = \$$ph_SubVar;<BR>";
eval("\$ph_SubVal = \$$ph_SubVar;");
}

Salsa

4:58 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Not sure, but if both the echo and the eval are part of the if condition, it may be a missing bracket:

}
else {
if ($ph_debug36) {
echo "<B>VarSub@".(__LINE__ + 1)."</B> \$ph_SubVal = \$$ph_SubVar;<BR>";
eval("\$ph_SubVal = \$$ph_SubVar;");
}

LABachlr

5:29 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Thanks, but that didn't work. That change made the form not work and gave the following error:

Parse error: parse error, unexpected $ in /home/neimanre/public_html/procs/lib/functions.php on line 581

Salsa

5:55 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Sorry that didn't help, but I just wasn't sure where the other closing brackets were, and I always try to look for the simplest possibilities first.

I haven't used the "evil() [us2.php.net]" function lately, and don't remember the syntax offhand, but I'd try commenting out the eval() line to see if and where the error gets thrown. That surely won't fix the problem but it might give some clues while waiting for someone else to offer better advice.

I wish you well.

LABachlr

6:06 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



OK. Thanks. I don't know PHP. This is a form from Phorm that was already constructed. I'll just have to wait until someone can figure it out.

Salsa

6:54 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Do you know where $ph_SubVal and $$ph_SubVar come from? If either of those is empty, I'd think you'd get that error from eval (especially after looking at your original message again). When you get your error message, what is on the line above the error message? It should be the result of:

echo "<B>VarSub@".(__LINE__ + 1)."</B> \$ph_SubVal = \$$ph_SubVar;<BR>";

...and will start like:

VarSub@...

What follows that is the values in $ph_SubVal and $$ph_SubVar--which are the values used in eval().

If there isn't a line that starts like that above the error message, temporarily comment out the echo line by putting two slashes in front of it, like:

else {
//if ($ph_debug36)
echo "<B>VarSub@".(__LINE__ + 1)."</B> \$ph_SubVal = \$$ph_SubVar;<BR>";

The whole section of code that you posted appears to simply be a debugging condition, so the script already knows that something is wrong farther up in the code, and it has something to do with $ph_SubVal and/or $$ph_SubVar.

LABachlr

7:03 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Found out the problem.

Here is the corrected code:

}
else {
if ($ph_debug36)
echo "<B>VarSub@".(__LINE__ + 1)."</B> \$ph_SubVal = \$$ph_SubVar;<BR>";
if(!empty($$ph_SubVar))
eval("\$ph_SubVal = \$$ph_SubVar;");
}

Thanks for your input!