CitizenErased Posted December 10, 2011 Share Posted December 10, 2011 Hello i'm a quite the novice when in comes to php so bear with me. I have information stored in php variables, and i'm wondering what is the best way to get that information to a html page to be put a a table or something. essentially I don't want to include the php code on the html page, but still somehow execute the php and get the information the the html page. Link to comment https://forums.phpfreaks.com/topic/252890-use-information-gathered-in-php-in-html/ Share on other sites More sharing options...
xyph Posted December 10, 2011 Share Posted December 10, 2011 There are many ways to do this - most aren't 'noob-friendly' Regardless, at some point you will have to mix code or some form of placeholder into your markup. Using include is probably the easiest method of keeping your logic away from your markup. Link to comment https://forums.phpfreaks.com/topic/252890-use-information-gathered-in-php-in-html/#findComment-1296599 Share on other sites More sharing options...
sunfighter Posted December 10, 2011 Share Posted December 10, 2011 From the PHP manual: PHP and HTML interact a lot: PHP can generate HTML, and HTML can pass information to PHP. You: essentially I don't want to include the php code on the html page You should take a little time to study php. php goes through an interpreter and generates html. php can not appear in html. You can make an entire html page with php. To put a php variable (ie. $phpvar = 'Cold Ice'; ) into a <td></td> of a html page you do this: <td><?php echo $phpvar; ?></td> and the browser will display Cold Ice where you want it in your table. Link to comment https://forums.phpfreaks.com/topic/252890-use-information-gathered-in-php-in-html/#findComment-1296646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.