Link to home
Start Free TrialLog in
Avatar of Ed_CLP
Ed_CLP

asked on

How to format/style SQL results page returned by PHP

I have an HTML form which submits a POST statement containing a SQL query to a PHP server.
The results are returned as a generic HTML table (see example).  Is it possible to add some CSS/AJAX to the results without having to modify the server-side pages?  I would like to add some additional formatting to the results.

//  source for page returned by PHP server

<html>
<head>
      <title></title>
</head>
<body>
<table>
  <tr>
          <td>Column1 Header</td>
          <td>Column1 Header</td>
          <td>Column1 Header</td>
          <td>Column1 Header</td>
  </tr>
  <tr>
          <td>840</td>
          <td>2010-09-13</td>
          <td>2011-09-09</td>
          <td>-234262.900</td>
  </tr>
</table>
</body>
</html>
Avatar of carsRST
carsRST
Flag of United States of America image

You will not need to modify anything on the server.  Just add CSS particular to the table.

Link below walks you through that process.

http://www.w3schools.com/css/css_table.asp
BTW - you can use the example below to put your CSS directly in to your page.  The other alternative is to put your CSS in its own file and reference.


<STYLE TYPE="text/css">
   ...css text...
</STYLE>



If you want to reference a file....

<link rel="stylesheet" type="text/css" href="myCSSFile.css" media="screen" />
Avatar of Ed_CLP
Ed_CLP

ASKER

I tried adding the <style...  tags in the <head> section of my HTML page, but the PHP results are returned as a separate page.  Would I have to embed the results in my original page?
I see what you're saying.  Your best option may be to use inline styles.  So that the table generated from your AJAX will have the styling embedded in it.  that way it is sure to be rendered.

Example:

<td style="background:#ccc; color:#fff;">Column1 Header</td>

Further explanation of inline styles:
http://webdesign.about.com/od/beginningcss/qt/tipcssinlinesty.htm
ASKER CERTIFIED SOLUTION
Avatar of Ed_CLP
Ed_CLP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ed_CLP

ASKER

I answered my own question.
Avatar of Ed_CLP

ASKER

question no longer active