in reply to Re: Separate Javascipt code from pure Perl code
in thread Separate Javascipt code from pure Perl code
It seems that you want to set a variable for your char_by_chars.js script file.Yes, exactly! This is a cool javascript displaying the contents of variable $data character_by_character. So you can see why it is essential for me to pass this variable from index.pl => char_by_char.js
print a( {href=>'/cgi-bin/register.pl'}, img{src=>'/data/images/reg.j +pg'} ); my @userlist = @{ $db->selectcol_arrayref("SELECT username FROM users" +) }; print start_form( action=>'/cgi-bin/index.pl' ); print h1( {class=>'lime'}, "Κάνε LOGIN γ +ια να δεις τις + παραγγελίες & +#963;ου μέχρι στι&# +947;μής => ", popup_menu( -name => 'userlogin', -val +ues => \@userlist ), submit('Σύνδε +ση!')); print end_form; my $userlogin = param('userlogin'); if ( param('Σύνδεση!') ) { unless( grep { $_ eq $userlogin } @userlist ) + #Check if userlogin name exists in the drop down menu { print br() x 2, h1( {class=>'big'}, "Δεν υ +πάρχει χρήστ&# +951;ς με όνομα: $userlogin" ) +; exit; } $select = $db->prepare( "SELECT counter, host, DATE_FORMAT(date, ' +%a %d %b, %h:%i') AS date FROM guestlog WHERE username=?" ); $select->execute( $userlogin ); $row = $select->fetchrow_hashref; if( $select->rows ) { $data = "Καλώς ήλθ^ +9;ς $userlogin! Χαίρομαι + που βρίσκεις +την σελίδα εν& +#948;ιαφέρουσα. Τελευταία +; φορά ήρθες εδ +;ώ ως $row->{host} στις $row->{dat +e} ! Προηγούμε +;νος αριθμών ε +πισκέψεων => $row->{coun +ter} Τί θα πάρε	 +53;ς σήμερα !?"; $select = $db->prepare( "UPDATE guestlog SET username=?, count +er=counter+1, date=? WHERE host=?" ); $select->execute( $userlogin, $date, $host ); } } else { if( $host eq "Νίκος" ) { $data = "Γειά σου Ν	 +53;κόλα! Πώς πάν	 +49; τα κέφια? ;-)"; } else { $data = "Γειά σου $host! Έρχεσαι γ +;ια 1η φορά εδώ !! Ελπίζω να β +;ρείς όλο το λο +;γισμικό που ε +πιθυμείς :-)"; } unless( $host eq "Νίκος" ) { $select = $db->prepare( "INSERT INTO guestlog (username, count +er, host, date) VALUES (?, ?, ?, ?)" ); $select->execute( 'Guest', 1, $host, $date); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Separate Javascipt code from pure Perl code
by shmem (Chancellor) on May 07, 2007 at 21:43 UTC | |
|