Jump to content

Recommended Posts

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

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.

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.