Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Stary problem
Anarion
post
Post #1





Grupa: Zarejestrowani
Postów: 88
Pomógł: 0
Dołączył: 22.04.2002

Ostrzeżenie: (0%)
-----


Pamietacie jak pytalem jak zrobic w <form>ie javascript?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Dostalem odpowiedz ale on nie dziala :? (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
<form action="java script:okno("poll.php?wybrana_opcja=$option"); method="post">
Jak zrobic to poprawnie?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Anarion
post
Post #2





Grupa: Zarejestrowani
Postów: 88
Pomógł: 0
Dołączył: 22.04.2002

Ostrzeżenie: (0%)
-----


Tak, funkcja jest OK...
Problem w tym ze w po wygenerowaniu strony kod ma postac:
<form action="java script:okno("poll.php?wybrana_opcja="); method="post">
Wiem ze dzieje sie tak bo nie ma wtedy jeszcze zdefiniowanej zmiennej $wybrana_opcja...
Oto kod skryptu:
Kod
<?

if($voting!=1)

{

$actpid=mysql_fetch_array(sql("select MAX(pollid) from polls;"));

$que=mysql_fetch_array(sql("select l1 from polls where pollid = $actpid[0] and textid = 0;"));

$anbr=mysql_fetch_array(sql("select count(*) from polls where pollid = $actpid[0] and textid = 1;"));

$fans=mysql_fetch_array(sql("select min(id) from polls where pollid = $actpid[0] and textid = 1;"));

$f=$fans[0];

$e=$fans[0];

for($i=1;$i<16;$i++)

    {

     $res=mysql_fetch_array(sql("select l1 from polls where id = $f;"));

     ${'ans'.$i}=$res[0];

     $f++;

    }

    echo("<br><center><span class="sonda">$que[0]</span></center>");

    echo("<form method="post" action="javascript:okno('poll.php?wybrana_opcja=$var,'300','600')" >");

    echo("<input type="hidden" name="que" value="$que[0]";>");

    echo("<input type="hidden" name="lng" value="l1";>");

    for($n=1;$n<=$anbr[0];$n++)

  {

    echo("<input type="radio" name="var" value="$e" class="sonda2"><span class="sonda2">${'ans'.$n}</span><br>");

    $e++;

  }

}

echo("<br><center><input type="submit" value="OK"></center></form>");

?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 11:41