Current location: Hot Scripts Forums » Programming Languages » PHP » Adding html to a php file


Adding html to a php file

Reply
  #1 (permalink)  
Old 05-12-04, 05:50 PM
Sal Collaziano Sal Collaziano is offline
New Member
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Adding html to a php file

Hi all.. Is this possible? Is there a way to add html code to a php file? If so, how can I do it?

Thanks in advance...
__________________
Sal Collaziano
OldsmobileForums.com
Reply With Quote
  #2 (permalink)  
Old 05-12-04, 05:52 PM
Bonzo's Avatar
Bonzo Bonzo is offline
Coding Addict
 
Join Date: Jan 2004
Posts: 340
Thanks: 0
Thanked 0 Times in 0 Posts
I think this was my first question on this forum !!

Call the page extension php not htm or html and create a html page as normal and where you want the php put <?php "php code here" ?>

If you want to add html to a php page then ?> html code here <?php

Anthony
Reply With Quote
  #3 (permalink)  
Old 05-12-04, 06:06 PM
Sal Collaziano Sal Collaziano is offline
New Member
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Great! Thank you. I can always rely on a fast answer at programmingtalk.com!
__________________
Sal Collaziano
OldsmobileForums.com
Reply With Quote
  #4 (permalink)  
Old 05-13-04, 06:26 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
what Bonzo said is correct, but sometimes you need to put inside the HTML some dynamic stuff!
so you can use this way too:
PHP Code:

//PHP code here..


//you can print HTML content here and a variable inside it..
echo '<p align="center">' $var '</p>';

//another way:
echo "<p align=\"center\">$var</p>";

//or
print <<<EOP
  <p align="center">$var</p>
EOP; 
but you need to check that quotes are escaped if you use the same quotes inside HTML like in example 2 ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #5 (permalink)  
Old 05-15-04, 12:15 PM
phpistasty phpistasty is offline
Newbie Coder
 
Join Date: May 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
yeah, and a fun lil thing that keeps me sane is like

....
PHP Code:

while($var=mysql_fetch_array($query)){


?>
<tr><td>
content <?php print $var['row'?>

</td</tr>
<?php
}

?>
just something that i use a lot
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
PHP write to text file veeco Script Requests 2 02-10-10 02:48 PM
PHP in HTML Pages? ZeoFateX PHP 19 01-04-06 06:42 PM
compare the contents of 2 file in php rani PHP 5 04-14-04 11:47 PM
php form to html file arnec PHP 1 01-21-04 10:14 AM


All times are GMT -5. The time now is 10:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.