Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Converting Table Data From HTML To PHP


I have a problem converting data from a html file, to a 3 way split. (header.php index.php and footer.php, Reason being PHP won't parse the following line,
<table width="37%" border="0" cellspacing="0" cellpadding="0" height="163">
I think it all revolves around the % sign, does anyone have any ideas about how to fix it without limiting the width to X amount of pixels?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
HTML Table With Data From Two Recordsets
I have two MySQL tables, say one is author and one is books. Author contains a unique PK say author_id Books contains an author_id also which links across to the author table. Usual stuff. My problem is getting at the info.

If I wanted to display the info, in it's mnost basic format, I would set up a HTML table with the columns and repeat the row. PHP Code:

Extract Data From Table Html
I would like to extract data from the table attached.
Could someone help me to create the regular expression to grab that
informations?

Displaying Data In Html Table.
I wondered if anyone could offer some guidance, I trying to write a
php script to connect to a database, and display the records in a
table.

I found the code here in a php4 text, and when I run this directly
through the php intrupeter, the line Successfully connected is display
and 4 as the number of rows.

The database table we connect to, has three field username, firstname,
surname.

When I tried a while loop, to display the data in a table. No values
were displayed.

Could anyone possibly demonstrate how to display the username,
firstname, surname values in a basic table?

<?php
function db_connect(){
global $MYSQL_ERRNO, $MYSQL_ERROR;

$link_id = mysql_connect("localhost","user04", "password04");

if(!$link_id){
$MYSQL_ERROR = "Connection failed";
return 0;
}
else if(empty($dbname) && !mysql_select_db("database04")){
$MYSQL_ERROR = mysql_error();
return 0;
}
else return $link_id;
}

!$link_id = db_connect();
if(!$link_id) die(error_message('Error connecting'));

$result = mysql_query("SELECT * FROM users");
if(!$result) error_message('Error in selection');
else echo "Successfully connected. ";

$query_data = mysql_fetch_row($result);
$total_records = $query_data[0];

if(!$total_records) error_message('No records');
else echo "$total_records.";
?>

Create A Data Entry HTML Form For Given Table
I am working on a simple web site updating utility for a web site. Rather than hard code the data entry forms, I would like to automactically generate them based upon the table a user selects to update or insert into. What is the best way to approach this?

for "insert" should I use the MySQL DESCRIBE table command and build a form element for each field according to its data type? for "update" should I use the DESCRIBE command to build the form as above and SELECT statement to populate each element with data, or should I just use a SELECT statement to retrieve the data and use php to determine the field type and choose an appropriate form element?

HTML Converting
How can I convert HTML into a form that PHP can work with it. For example if I have a HTML code that looks like:

<textarea rows="2" name="S1" cols="20"></textarea>

How can I change the " into single ' ? <textarea rows=&#392;' name='S1' cols=&#3920;'></textarea>

Converting HTML To PHP
A friend and I are converting a site from *.html to *.php. The site already recognizes the *.php files - and the most current version of PHP is running on the server (*.nix).

We plan to leave the *.html files in place, due to their inclusion in search engine databases and user bookmarks.

Here are my questions, that I would appreciate your help with:

1). Are there any problems or issues that I should be concerned with, considering that I might have both an index.php and an index.html in the directories at the same time (unless there is a better way)?

2). Is there any search-engine-friendly way to add refresh statements (meta or javascript) to some of my html files? If so, please share code example. [I'd only add the refreshes to those pages that are a part of the main site structure - i.e. index.html files in the directories.]

3). If I have to go the parsing html as php method... Is the "AddType application/x-httpd-php .html" statement valid to be in the "current version of PHP's" httpd.conf file? Or, does it need to be like this "AddType application/x-httpd4-php .html" (with the &#394;' included)? Also, is that all that is needed to make PHP parse *.html as *.php? [By the way, I am somewhat aware of the .htaccess method.]

4). Does anyone have any examples of how speed is affected by having the *.html files parsed as PHP files? If so, please share.... [Speed is of big concern...]

I appreciate your help with this. I need to upgrade this site and there are hundreds of pages that are currently in the search engines that I do not want to interfere with.

I know that I can keep the html pages and have them parsed as php, but I have already built much of the new site (with many links) with php extensions. So, I planned to drop the new site in the directories with the old site. Pages that are not a part of the main structure (main, products, contact, news, .... and other index.html pages, I will just change the links in them to point to the new index.php pages -- but the main index.html will have to remain and have links updated and/or refresh code).

I really need to find some straight-forward help with this, so that I can do it in a way that will not hinder the site's standing in the search engines.

Converting Pdf To Html
I am working on a script that opens email attachments and copies the
contents into the body of the email in html format. Does anyone know
if there is a way to convert pdf files to html on the fly, using php?

Converting HTML To A PDF
I am looking for some advice on converting HTML to a PDF file. I used to use HTMLDOC (easysoftwareproducts.com) on my personally hosted server, because I could install it. However, most web-hosting sites do not allow that.

I found FPDF (Free PDF) PHP library, that allows you to manually draw in text, lines, rectangles, etc. While that is NICE, I am looking for something that my users can create custom templates in HTML and add [TAGS] for populating with database fields. I wish I could use WORD or something, but HTML should be OK for most.

Converting HTML Characters With PHP
In PHP4 there is a function called:
get_html_translation_table (HTML_ENTITIES);

which enables you to leave some HTML-code as it is, like ë for instance.

Converting HTML To A Picture Using Php
I have a tutorial section on my forum with tutorials on photoshop, imageready, apophysis and stuff like that.  The tutorials have pictures and text and I want people to be able to be able to post the tutorials on their forums with ease, but not in text format. I want them to be able to use a dynamic url that will use php to convert the html page to an image, with an anti-rip watermark in the background.

How would I go about converting the html to (and the pictures) so that the person can make this image. I don't know if I'm explaining this well enough. Basically, I want the person to be able to post an exact replica of the tutorial in picture format.

Converting MySQL Fields To HTML
I have a VARCHAR(255) field in a MySQL database that contains Carriage Returns and Line Feeds.

I'm trying to display the contents of this field in html with printf, but the CrLf's are being ignored by the printf.

Does anyone know an easy way of parsing a string with CrLf's into HTML?

Converting Rich Text To Html
I want to do is upload a rich text file to the server and have PHP covert the text to format html for the body copy of a page. I was thinking about people just using Word or something like it and save as a rich text, then they upload it.

Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?

Converting The Posted String To The Value Of Html Element
I've been very confused in dealing with posted strings. For example, if I fill in a text element with "(double quote), submit it and display it in a text and a textarea, I get "(backslash followed by double quote) in the textarea element but (backslash only) in the text element.

Code:
<input name="somename" value="<?php if(isset($HTTP_POST_VARS['submitName'])) echo $HTTP_POST_VARS['somename']; ?>" />

I made a function which correct the misbehavings:

Converting FROM Html Entities Inside TEXT VALUE Parameter
I am experiencing some very odd behaviour using a function that converts from htmlentities unhtmlentites() - equivalent to pre-made html_entity_decode() in more recent versions of php. The function works fine, but when I echo inside a form, something goes wrong. Please look at the following code, in particular the output near the bottom.

This is a survey that saves form POST information in a mysql database, that is called back to the, rather long form, to show the user what they have already answered (by outputting answers back to the form). PHP Code:

Testing Htmlspecialchars() PHP Function - Converting HTML Characters
Testing htmlspecialchars() PHP Function - Converting HTML Characters

When data needs to be presented in Web pages, HTML special characters
must be well protected Otherwise, data well not be presented properly,
or the Web will become corrupted. This page allows you to learn and
test the htmlspecialchars() function to protect embedded data in Web
pages.

Grab Data From A Table, Echo, Then Insert It Into A New Table...
I'm trying to do is count the number of times usernames shows up in a table. I then want to reinsert that information into a different table with the Username in column1 & the occurrences in column2 for every user that is echoed on the page. Code:

Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'.

There is one of each item in products and each product has it's own unique 'prodno'

There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example:

id = 1
prodid = 7001
qty = 300
price = 12.5

id = 2
prodid = 7001
qty = 400
price = 15.5

I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table.

Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item..

This is all very confusing to me, and I'm the one writing it. Let's try one last time..

Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.

Update Table While Insert Data To Another Table
it seem like mine coding din work.
[php]<?

include("checkin.html");
$conn=mysql_connect('localhost','root','') or die ('Could not connect to server');
$today = date("Y.m.d");
mysql_select_db('hms', $conn);

$ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn);

if( $ok ){

$up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID');

if(mysql_affected_rows( $up ) == 1)
{
echo'Checked IN!'
}else { echo'No such student to check in' }}
else { echo'Check In FAILED, please check again'}?>[php]

How To Transfer A Data With An Id To Another Table From A Table?
how am i going to transfer let say a name identified using the suer id and copy the name to the other table having the same user id>?

Moving Data From One Table To Another Table
Does anyone know how to move one row from a table in a mysql database to another table using php?

Converting A PHP Site To A Total Static HTML Site
What's the best way to convert a PHP site to a total static HTML site? You might wanna ask why I wanna do this. Reason: I would like to create an offline version (without server) for demo purposes. Looking at my current PHP site, I am having problem dealing with this issue.

Converting Html Pages Into Dynamic Pages
I built a website in html, using Dreamweaver. I need to have a database built within these pages and the person who is going to do it told me that they will have to convert all my html pages into dynamic pages (php).

Is it complicated to do this or do I just have to save my pages in php instead of html in Dreamweaver ?

How To Export A Table To HTML ...
In my project I want to export a table from a database to HTML format , in a simple table, and save the file to a specific dir/.

Put A Html Table In A Variable
I want to do the following: I want to draw a table in html (with the echo command) and put that in a variable so I can draw that table via that variable. I got the following (large table ;-) Code:

Php Condition In A Table With Html And Php
I would like to show a line in a tabel in html if there is quantity of
article choosed.

My code is:

<? if ($quantite1 0) {
echo('
<tr>
<td align="left" nowrap="nowrap">Article 1</td>
<td align="center"><? echo $quantite1 ?</td>
<td align="center">20 &euro;</td>
<td align="center"<? echo $montant1 ?&euro;</td>
</tr>');
}
else{
echo("");
}
?>

If there is no article >no line
If there is article >show the line

Problem: I can have the variable $quantite1 and $montant1 en php

Extract An HTML Table
I have an html-file, in which there are a table. I wants to extract this table. PHP Code:

HTML Table To Excel
I am running a MySQL SELECT query to dump the output to an excel file. I have tried various methods (CSV, PHP Classes to build excel docs, etc.) I ended up using a variation of a lot of the ones I have tried. I am using an HTTP header in PHP: PHP Code:

Displaying A HTML Table With PHP
I'm new to PHP and I'm trying to get my head around databases at the moment. So far I have a page that kinda takes the mickey and takes a few details from you, it then creates a cookie that can be removed later. It also prompts you to add the data you gave to a database.

All this works perfectly, but when it comes to displaying the results of the database, all I can show is the first entry in the table. Can someone please tell me how I'm supposed to see all of them?

I've read other articles but they don't make much sense to me.

BTW, the database details are as follows:

Database name: visualanteorg
Table name: people
Fields: id, name, shoe_size, job

As you will see if you choose to look at the pages, getting the information out is not a problem, it's just formatting it how I want it, so each entry appears under the other in the table.

Convert Html Table To Csv
i need to write a script to automatically convert some statistical data from an html table to csv there are two problems that i'm having, depending on the user or the options selected, some rows won't be shown, and some will so in the code, there are a heap of if statements to hide/show columns which makes it especially hard when we need to add new columns for the html view, something else i need to look into i guess.

i thought the easiest way, might be to use file_get_contents() to grab all the html code cos it's all laid out nicely already but then i thought about the colspans which would affect the comma seperatedness of the header columns (if you get that) does anyone know of a good, effective, scalable solution to this problem? Code:

How To Parse HTML TABLE
I have a problem with parsing html table. I need a script witch will pars html table from one site to another.

How To Count Html Table Row?
i am trying to echo "room_Type_break" field, the problem is it only prints twice of each room_Type. for e.g.

cal.php

room_type
--------
ensuite
ensuite
single    
single

book.php : Output:

single single

it is not printing out ensuite...any idea?

cal.php
if($qty !== '0'){
$p=0;
while($fday<$tday){
echo "<td>$room_Type<input type='text' name='room_Type_break' value='$room_Type'></td>
$p++;

}echo "<input type='hidden' name='count' value='$p'>"; }

book.php
for ($i = 0; $i <= $_POST['count']; $i++) {
 
 $room_Type_break = $_REQUEST['room_Type_break_'.$i.''];

echo "$room_Type_break";
}

Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email
addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so
on.

Tricky Html Table Output
I have a bunch of Result objects in an array. I want to output a summary table for those results. A Result object has the following attributes:

1. species
2. tissue
3. stage
4. gene
5. sex
6. replicates
7. value

The db query returns the rows sorted by species, then tissue, then stage, then gene, then sex. The object attributes will be the table headings (<TH>).
Each row of the <table> will be divided into 3 subrows- 1 for each sex: male, female, mixed ( it's all PG here!) .

All of the above is straightforward. However, I would like to print the value of attributes 1-4 only if it is different from the row above: ie

Species |Tissue|Stage|Gene|Sex ...
bug|ear|first|brca|male
...|...|...|...|female
...|...|second|...|male
spider|toe|creepy|hox2|female

The only php solution I've come up with is putting all the object attributes into a multi-dimensional array and then checking if current value=old value as I nested loop my way through the array. Needless to say, not very elegant.

Any thoughts on how this could be cleaner? I can just output the table with all the values filled in (that's easy), but I believe the relavant data pops out more if there is less verbiage.

HTML Table Fetched From A Database
I want to generate a HTML table based on names fetched from a database. The tricky part is that I want to generate the table so that the names is written on both the top row and the left collumn. Should look something like this

----------------------------------------------
| ||NAME 1 | NAME 2| NAME3|
|NAME 1| | | |
----------------------------------------------
|NAME2| | | |
----------------------------------------------
|NAME3| | | |
----------------------------------------------

Hope that anybody has a idea how to solve this.

Geting Values From Html Table
I'm trying to build a scrip that would open a page that has a table and then
get all the values as variables so I can put them in a MySQL DB.
The problem is that I don't really know where to start...

This was my idea split the page in two cause there's 2 tables and I just
want the second one, then clean up what I don't want and finally assign the
variables...

something along these lines... sadly this doesn't work :(

<?php
ini_set('error_reporting', E_ALL);

ini_set('user_agent','MSIE 4.0b2;');

$handle = fopen("http://www.scuniverse.net/Hist/HOF.htm", "r");
$page = fread($handle, 20000);
$row = explode("TR",$page);

$i=0;

while ($i < 31)
{
list ($Rank, $Name, $Castle, $Land, $KS, $Race) = explode("TD",$row[$i]);
$i++;
}

Creating An Array From An HTML Table
Before I try to do this myself (I remember doing it in Java years ago
and it was a pain)....

Has anyone run across a function that will take a string parameter
containing an HTML table, and return a 2-dimensional array with each
element corresponding to the contents of a table cell?

I see plenty of examples of doing the opposite: convert an array to
an HTML table. I want to go the other way, from an HTML table to an
array.



HTML Table Update Row PHP/MySQL
I have a dynamic HTML page with 4 columns of data, retrieved with PHP
from a MySQL database.
At the end of every row I have an UPDATE submit button, which activates
a php update script to update the database. I now encounter the problem
that in the update script I cannot trace back for which row the UPDATE
buttom was pressed.

I first had defined the UPDATE button as : <input name="update"
value="UPDATE" type="submit">. That doesn't work ...
If I change the definition to <input name="update" value=<? echo
"UPDATE".$nt['id']; ?type="submit">, then I can get the id number in
the update script, but the display is not that good, because you see
UPDATE1, UPDATE7,UPDATE4 and so on ...
So I need something, so I can find back in the update script for which
row the update button was pressed. Each row has his unique id (which is
not shown in the table)

Tab Delimited Txt File To Php Html Table
Wouldn't you know that when I finally find a tutorial using Google that does exactly what I want, the code doesn't run when I use it ...

However, when it gets to this line, for ($i=0; $i<td>$line[0]</td>, it chokes on one of the '>'.

Since my php skills are very basic, and in no way include arrays, can someone assist me with this?

If it's easier to do it differently, what I'd like to do is create a table in Excel/Access, export it to the server (to a tab-delimted text file, since I'll be using commas in my table cells), and have it display in an HTML table.

If I can't figure this out, I'm tempted to just export to HTML from one or the other program (not sure quite yet which I would use), so ...

Reading HTML Table Values
So I have a webpage I'm working on that uses javascript and PHP to manage a table that contains rankings. The users selects, using radio buttons, their top 5 specializations. As they are selected they are inserted into an HTML table at the base of the page using javascript.

My question is,  I want to save these values into a mysql table when the save button is clicked and I need to be able to pass the current value sin the table to php variables so I can use them in mysql queries.

Results From Two Db Tables Into One Html Table?
I have a query below that gets its results and puts them in a table. The current results are from two fields in a db table. I am wondering if it is possible to create a second query to get results from a different db table and echo them out in the same html table as the ones already there? Code:

Table Data
I have a table on a php page with the cells containing database data from a mysqldatabase.
what would be the easiest way to allow a user to change how the data is listed by clicking on the top of each data column? I have seen this feature on most applications but cant figure out how to doit??

Table Data Row
I have a script that pulls information from a table. This table contains foreign id keys for other tables. This code works just fine, but pulls id numbers. I would like to make a change to this file to convert the id numbers into their matching names. I have tried to use this type of code:

Data Into Table
I'm trying to get a neat and clean readout of all of the parasites that are in the MySQL table. Right now everything works except all of the info is all over the table and I can't seem to get the table to be clean and presentable for when I open my site to the public. Code:

Display Results From Query In HTML-table
I'm working with PHP3 and Oracle 8. Can anyone tell me how to display the results from a query into my HTML-table?

Empty HTML Table Cells Have No Borders, What Do You Do?
When I first start using databases and dynamic content, I noticed that when you use table borders in your designs and if the database column/row doesn't have any info the html table outputed looks funny. I was wondering how you handle this.

I use a function that puts a clear gif image.

Code:
//This function is used for replacing an empty var with a clear gif 1px X 1px
function replace_empty($vars) {
if ($vars =="") {
$vars = "<img src='images/clear.gif' width=&#391;' height=&#391;' alt=''>";
}
echo $vars;
} //End function replace_empty

Or you could use some CSS like "empty-cells: show"

Output Query Results To Html Table
I have a MySQL table "products" and I want to output product's data to html table as below:
- A products contain 4 fields: image, name, description, price.
- 4 products is nested in 1 html table 4 rows x 4 columns.

Code:

Parse HTML Table Rows Into Array
I have a script that extracts an HTML table from a page into a text string. I would like to parse each row of the table into an array named "$rows". I would like to keep the html intact so that I could re-create the same table like: Code:

Formatting Mysql_fetch_array Results In HTML Table
This looks like a simple problem, but I just can't seem to wrap my
head around it.

I'm trying to build a table dynamically, based on a result set from
mysql. There will be 9 results for a full page, with 3 table rows of 3
table cells. One result per cell. But all of the pages won't be full.

Here's one of many ways I've tried to do it:

<html>
<head>
<title>test</title>
</head>
<body>
<table width="100%" border="1">
<?php

include_once('db.inc.php');

$query = "SELECT DISTINCT title FROM mytable LIMIT 9";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
}

for ($i = 0; $i < 3; $i++) {
print ' <tr>' . "
";

for ($e = 0; $e < 3; $e++) {
print ' <td align="center">' . "
".
' title : ' . $title . "
".
' </td>' . "
";
}
print ' </tr>' . "
";
}


?>
</table>
</body>
</html>

This prints out 3 rows of three like I hoped, but $title is the same
in all 9 cells. I also have tried it with the for loops inside the
while loop, which prints out 9 rows of 9 cells 9 times!


Copyright © 2005-08 www.BigResource.com, All rights reserved