Newbie Q: isset interpret?

Newbie Q: isset interpret?

am 21.04.2008 19:16:34 von Pat Willener

Hi,

Complete newbie here, no C or related language background; starting from
the basics. I DO have Visual Basic 6 (non .NET) and batch file
experience, but that's all.

I have the following statement in a piece of code I chose to analyze.
It's from a captcha form script but it is a pretty standard thing in
many such scripts.
I understand the first line fine.
---------------
echo 'onload="document.forms[0].scratch_submit.focus()"';
}
?>
--------------

But the echo statement confuses me. Can anyone provide an English
language description of the echo line for me?
In particular, the significance of [0] and the
scratch_submit.focus().
No problems understanding the use of {, }, ', " and ;.

IS "scratch_submit" a PHP internal or is it an assigned variable? I
see it used in so many different scripts that it appears to be part of
PHP (I'm using version 4 on XP-Pro and Xampp for a local server.), but I
can't find it referenced anywhere.

Same question for ".focus"?

Thanks much for any assistance you can offer,

Twayne

Re: Newbie Q: isset interpret?

am 21.04.2008 19:27:05 von zeldorblat

On Apr 21, 1:16 pm, "Twayne" wrote:
> Hi,
>
> Complete newbie here, no C or related language background; starting from
> the basics. I DO have Visual Basic 6 (non .NET) and batch file
> experience, but that's all.
>
> I have the following statement in a piece of code I chose to analyze.
> It's from a captcha form script but it is a pretty standard thing in
> many such scripts.
> I understand the first line fine.
> ---------------
> > echo 'onload="document.forms[0].scratch_submit.focus()"';}
>
> ?>
> --------------
>
> But the echo statement confuses me. Can anyone provide an English
> language description of the echo line for me?
> In particular, the significance of [0] and the
> scratch_submit.focus().
> No problems understanding the use of {, }, ', " and ;.
>
> IS "scratch_submit" a PHP internal or is it an assigned variable? I
> see it used in so many different scripts that it appears to be part of
> PHP (I'm using version 4 on XP-Pro and Xampp for a local server.), but I
> can't find it referenced anywhere.
>
> Same question for ".focus"?
>
> Thanks much for any assistance you can offer,
>
> Twayne

That's JavaScript. PHP runs server side and generates a bunch of
output (typically HTML, but it doesn't have to be). This output is
then sent back to the user-agent (typically a web browser) where it is
interpreted and/or executed.

What this means is that the code
onload="document.forms[0].scratch_submit.focus()" has no meaning to
PHP itself -- it's simply a string of text that will be sent back to
the browser. The browser itself is then responsible for executing it.

As for what that JavaScript code actually does you'll need to ask in a
JS newsgroup.