Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-21-2004, 01:19 AM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default PHP inside html

I like to program in html because, well, thats what I know. I have some webspace with php support and want to add a php poll and maby some other dynamic content. Everry time I try to add a php yo my html it doesent work. Ive tried adding it through a SSi and not, Ive tried revaming the file, the script works but the page loses all it's html. It there a way to do this, or do I need to find another way?
The-Chihuahua is offline  
Old 11-21-2004, 02:14 AM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default

You need to do this:
To start PHP script/code:
<?php
put_your_code_here

when done with the PHP, use
?>

<?php tells the server/php engine to interpert that part of the code, while ?> exits. You can start/stop as many times as you want...just make sure to leave the HTML code outside of the PHP start/stop codes!

Is that what you meant?
__________________
Vormund is offline  
Old 11-21-2004, 03:16 AM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default

tried that but it doesen't work, my code is a very simple test.

<?php echo "Hello World"; ?>

and it on my index.html page yet I see no hello world
The-Chihuahua is offline  
Old 11-21-2004, 03:28 AM   #4 (permalink)
 
Super Techie

Join Date: Jun 2004

Posts: 312

sippin codeine

Send a message via Yahoo to sippin codeine
Default

just change the index.html to index.php
__________________
**[System specs]**

Delphi Enterprise 6 - 7
VB 6.0 - 2005 EE
sippin codeine is offline  
Old 11-21-2004, 03:54 PM   #5 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default

then nothing else shows up, only the one line of text and the hello world, My tables and background css and ssi are all gone
The-Chihuahua is offline  
Old 11-22-2004, 10:26 AM   #6 (permalink)
ADZ
 
Master Techie

Join Date: May 2003

Posts: 2,233

ADZ is on a distinguished road

Send a message via Yahoo to ADZ
Default

you cannot view PHP locally unless you are runing PHP...upload your files to a web server that supports PHP and test it.
ADZ is offline  
Old 11-22-2004, 11:14 AM   #7 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

maybe that extra line of "Hello world" is throwing the tables out of wack.
You file should look something like:
Code:
<html>
<body>

<?php echo "Hello World"; ?>
</body>
</html>
named index.php
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
Old 11-24-2004, 01:09 PM   #8 (permalink)
 
True Techie

Join Date: Nov 2004

Posts: 128

Iantosca

Send a message via AIM to Iantosca
Default

Yes, you can put html into a .php document as long as it is outside the <? php code here ?>.

Just make sure the file is named whatever.php

<html>
<head></head>
<body>

<? php code ?>

</body>
</html>
Iantosca is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On