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!

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.