William:
I'm not sure if I can answer your question, but I know you can mix
javascript with php just like you can with html.
For example, I use (below code from a working example):
<script language="javascript"> alert("===" +
document.form.f.what_db.value + "==="); </script>
where "what_db" (above) is a variable generated in php -- really!
So, I would play around with the idea and I think you'll find that
variables pass through to javascript very well "as-is". I was
surprised at how easy it was.
As to your problem described below, I'm doing something very similar
and I'm not using javascript at all. I just generate a form with the
images (from mySQL) in thumbnails with checkbox beside them.
The user selects what they want, clicks submit, and then I do my thing.
HTH's
tedd
Hello,
How can I get my PHP variable values to a javascript?
Here's the code:
<SCRIPT>
function btnOKClick($file) {
DO STUFF TO IMAGE
/<SCRIPT>
<input type="submit" name="btnOK" value="OK"
onClick="javascript:btnOKClick($txtFileName)">
<BUTTON ID=btnCancel type=reset onClick="window.close();">Cancel</BUTTON>
<?php
$sql="SELECT * FROM images ORDER BY 'date' DESC";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
$cur = 1;
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$id = $row["id"];
$iso = $row["iso"];
$thumpnail = $row["thumpnail"];
$date = $row["date"];
echo "<div class=\"float\">";
echo "<div align=\"center\"><img src=\"$thumpnail\"></a><br /></div>";
echo "<div align=\"left\">$ladattu</div>";
// File path as value here. I need to send this to Javascript
echo "<div align=\"left\"><input type=\"checkbox\" name='txtFileName'
value='$thumpnail'>ADD</div>";
// File path as value here. I need to send this to Javascript
echo "</div>";
$cur++;
}
?>
There's two buttons OK/Cancel at the top of the page. Then image thumpnails
are looped to screen as many times there are DB entries. Under each
thumpnail there's checkbox with ADD text. The checkbox value is/should be
path to the image file. So I need this path info in the javascript to handle
the image when user clicks OK button but I don't know how?
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
--------------------------------------------------------------------------------
http://sperling.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php