English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How and where can I insert php code to html webpage? Is it working without any problems? Can I insert it any TD to see effects? Thanks...

2007-07-05 05:26:50 · 5 answers · asked by ziik 1 in Computers & Internet Programming & Design

5 answers

You can stick it anywhere you like. But the webserver needs to be setup for PHP obviously. And the file probably needs a *.php extension.

[edit] It's a long story, but is recommended over

2007-07-05 08:35:36 · answer #1 · answered by Anonymous · 0 0

Depending on what the output of the PHP you're going to insert is, you can be or not able to insert it anyway.

If you just want to assign a value to a variable, then you can do that anywhere, provided you do it, before you use said value.

If you want to write something in an HTML document, then you need to do it inside the body tag.

Oh and of course, you need to put all you PHP code inbetween .

2007-07-05 06:53:23 · answer #2 · answered by Vera 5 · 0 0

You do not "insert" PhP in HTML.
You insert HTML in PhP!
PhP runs on the server, before it downloads to the client, in the form of an HTML...
An example:
I want to pick up an image at random. All images are made with the name "mypicX.jpg", where X is a digit from 1 to 9.
My PhP code (well, with HTML!)
echo ("");
?>
If rand() returns 3, what will be downloaded on the client is:

The PhP has disappeared (stayed on the server!)

Same style:
HTML
.jpg>
will send the very same thing... The PhP is "inserted" in the HTML... (sort of)

2007-07-05 20:51:26 · answer #3 · answered by just "JR" 7 · 0 1

You can stick it anywhere - depending on what you want it to do.
But for most applications, sticking it in the is probably what you have in mind. Obviously, you need PHP installed on the server that is hosting your webpage. Try
echo phpinfo();
?>

2007-07-05 05:39:07 · answer #4 · answered by Anonymous · 0 0

Hey, Well you can put PHP anywhere in HTML! You just need to start with ""

Thats it!

Thank you,
Greg Winn
http://winn.ws

2007-07-05 05:32:15 · answer #5 · answered by Greg W 2 · 0 0

fedest.com, questions and answers