Thread View: pl.comp.lang.javascript
2 messages
2 total messages
Started by Renke
Sat, 19 Jun 2010 18:12
Problem ze zmienną PHP w 'Alercie'
Author: Renke
Date: Sat, 19 Jun 2010 18:12
Date: Sat, 19 Jun 2010 18:12
22 lines
1697 bytes
1697 bytes
Jestem początkującym, wymyśliłem sobie komunikat Alert w walidacji
formularza.
<?
walidacja formularza...
$komunikat = 'komunikat z walidacji';
?>
<script type="text/javascript">
function show_alert()
{ alert(" <? echo $komunikat; ?> "); }
</script>
formualrz...
<input type="button" onclick="show_alert()" value="wyślij">
Problem polega na tym, że wyświetla się alert bez danych z $komunikat
ponieważ odwołanie jest do funkcji poniżej walidacji i komunikat jest
pusty. Dopiero po przeładowaniu otrzymuję poprawny komunikat w alercie.
Jak rozwiązać problem gdy formularz zostanie wypełniony poprawnie i
alert nie będzie potrzebny ?
Maciek
Re: Problem ze zmienną PHP w 'Alercie'
Author: TornadoTN
Date: Sun, 20 Jun 2010 10:13
Date: Sun, 20 Jun 2010 10:13
19 lines
1492 bytes
1492 bytes
W dniu 2010-06-19 20:12, Renke pisze:
> Problem polega na tym, że wyświetla się alert bez danych z $komunikat
> ponieważ odwołanie jest do funkcji poniżej walidacji i komunikat jest
> pusty. Dopiero po przeładowaniu otrzymuję poprawny komunikat w alercie.
> Jak rozwiązać problem gdy formularz zostanie wypełniony poprawnie i
> alert nie będzie potrzebny ?
>
<?php
if (isset($komunikat) && $komunikat!='')
{
?>
Tutaj kod HTML/Javascript
<?php
}
?>
Pozdr
Tomek
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads