Jump to content

PHP wariable to Java script

- - - - -

  • Please log in to reply
2 replies to this topic

#1
RaisRay

RaisRay

    Newbie

  • Members
  • Pip
  • 1 posts
Hi
I have PHP/ MySql photogallery script where I want to add Slideshow. Is there anybody who can give idea how to convert PHP variable to Java. Is this simple thing to do or may be its not worth to do because I'm not experienced is Java.
I was looking for tutorials or samples but unsuccessfully.

#2
Mark Wylde

Mark Wylde

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
What do you mean convert it to Java? Do you want to convert the whole script into Java? If this is the case I highly doubt you'll find a solution apart from rewriting it yourself. It's hard to sometimes convert code within the same language, eg VB6 to VB.NET using only a converting tool.

If you just want to use a variable in JavaScript then just use something like:

<?php

$variable = 1200;

echo "<script> a = " . $variable . ";</script>";

?>


#3
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Ok I'm assuming you mean Javascript not Java.
Any part of a page can have PHP so Mark is right. Also if you wish to get a variable or any other object (or wish to hand them back) once the page has loaded without reloading use AJAX (its just a method of communicating with the server using Javascript) just Google it.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users