Page 1 of 1

Call PHP Function for HTML Page

Posted: Sat Oct 12, 2002 5:03 pm
by PHIEUDZU
I am new (bie?) to PHP. I try to convert some JavaScript code to PHP. How do I call a PHP function from my HTML link? I wrote a function ShowImage($ImgName) in side the ShowImg.php, and test with

$ImgName = "01.jpg";

by call from another PHP program, the function work fine, but I do not know how to call function ShowImage($ImgName) and pass the param to PHP from my HTML link. Please HELP
Thank you.

Posted: Sat Oct 12, 2002 7:32 pm
by volka

Posted: Sun Oct 13, 2002 3:01 am
by Takuma
If you want to pass a variable use somethine like

http://www.something.com/index.php?hello=by

Posted: Sun Oct 13, 2002 6:53 am
by PHIEUDZU
Thanks Takuma and Volka, but that is not what I am looking for. I try to convert from HTML/JavaScript coding to PHP code. :(
You may click here http://www.lovemyphoto.com/index.php to see my site.

I am try to undestand from both of you:

<A class=postlink href="viewtopic.php[b]?t=1030"[/b] target=_blank>Sticky: Before Post Read: Frames, JavaScript, and PHP Overview</A> answer the question?

and

<A href="http://www.something.com/index.php[b]?hello=by[/b]" target=_blank>http://www.something.com/index.php?hello=by</A>

What is the viewtopic.php?t=1030, is this the param PHP pass to it the viewtopic.php?

How do I pass a param "image.jpg" to the ShowImg.php below?
http://www.lovemyphoto.com/ShowImg.php?[b]what to write in here?[/b]
Please HELP

Passing Variables

Posted: Sun Oct 13, 2002 10:27 am
by AVATAr
If you want to pass a veriable to a php script:

http://www.lovemyphoto.com/ShowImg.php?variable=value

for instance:

http://www.lovemyphoto.com/ShowImg.php?image=image.jpg

then in your php page: ShowImg.php, you use the $image variable to display (read the sticky as Volka said) on how to read this kind of variables in posts and gets..

hope it helps
?>

Posted: Mon Oct 14, 2002 3:07 am
by PHIEUDZU
Thank you, AVATAr.
It's work perfect.