Call PHP Function for HTML Page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PHIEUDZU
Forum Newbie
Posts: 4
Joined: Sat Oct 12, 2002 5:03 pm
Location: Northern California

Call PHP Function for HTML Page

Post 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.
Last edited by PHIEUDZU on Mon Oct 14, 2002 11:02 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

If you want to pass a variable use somethine like

http://www.something.com/index.php?hello=by
PHIEUDZU
Forum Newbie
Posts: 4
Joined: Sat Oct 12, 2002 5:03 pm
Location: Northern California

Post 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
Last edited by PHIEUDZU on Mon Oct 14, 2002 10:55 am, edited 1 time in total.
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Passing Variables

Post 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
?>
PHIEUDZU
Forum Newbie
Posts: 4
Joined: Sat Oct 12, 2002 5:03 pm
Location: Northern California

Post by PHIEUDZU »

Thank you, AVATAr.
It's work perfect.
Post Reply