Jump to content

Embedding .php File Into Html Form Or Table


monkey64

Recommended Posts

I’d better make it clear that I’m really new to MySQL and PHP programming.
I have a good working knowledge of HTML and CSS, but these two are tough languages!

All I want to do is display the contents of a field in a given database table in an HTML page. I’d like to show these contents either in an HTML table, or the text area element of an HTML form.

So far, I’ve created the following code which executes correctly from my .php page and displays the data as I wanted. However, I’m mystified as to how to embed this data into a table, grid, or text area element of an HTML form.

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]<?php

// Make a MySQL Connection
mysql_connect("localhost", "realbab_mark", "coco") or die(mysql_error());
mysql_select_db("realbab_phpbb1") or die(mysql_error());

// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM phpbb_posts_text")
or die(mysql_error());

while($row = mysql_fetch_array($result)){
echo $row['post_subject'];
echo "<br />";
}

?> [!--colorc--][/span][!--/colorc--]

Can anyone help me before my head explodes!

Link to comment
Share on other sites

Well you're in luck because something similar to your question has been answered... 4 times today. Follow this link and read what I posted, it should give you an idea on how to insert the HTML. In order to use a textarea you would just wrap the resulting column in a <textarea> tag, likewise for other stuff.

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=97058\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=97058[/a]
Link to comment
Share on other sites

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.