You are here: Re: Having a problem mixing HTML and PHP « PHP Programming Language « IT news, forums, messages
Re: Having a problem mixing HTML and PHP

Posted by Kim Andrι Akerψ on 12/10/96 11:48

tony@tony.com wrote:

>
> I am trying to use a form with a button that calls a verification
> script but can't seem to get the script to run at all - can anyone
> tell me if this SHOULD work in a forms onCLick or have I got the
> syntax wrong?
>
> The function is previously included with include_once('library.php');
> This seems to work ok. I dont get any php errors if I turn on
> reporting. The function checks out ok on its own. I've also tried a
> simple echo with no luck. the page is called myform.php (not .html)
>
> The form button has:
>
> <input type=button name="btOne" value="Click-Me" id = "mButton"
> onClick = "<?PHP verify(); ?>" >
>
> I did think you could do this - am I wrong?
> (Incidently I'm also having trouble getting onBlur to work in a
> similar form with PHP.)

PHP is processed on the server, and does this *before* the user ever
sees the HTML page, meaning that the verify() you have is called before
the page is displayed to the user.

Rather use a submit button and let the script referenced to in the
"action" attribute of the <form> tag handle the verification of the
fields.

A process like the one you're shooting for can be done using AJAX, but
in this case, that could be more trouble that it's actually worth.

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация