Jump to content


Photo

pasting a table in html code into a field


  • Please log in to reply
4 replies to this topic

#1 tpfp

tpfp
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 25 September 2006 - 10:31 AM

is there a way to pasting a table in html code into a field on a form then submit it to a database and display the entry as a table.

etc if i paste this into a field called info.

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="33%">name</td>
    <td width="33%">surname</td>
    <td width="34%">age</td>
  </tr>
  <tr>
    <td width="33%">billy</td>
    <td width="33%">gates</td>
    <td width="34%">54</td>
  </tr>
</table>

how would i then display it as a table instead of the code.
this is how i currently display and convert text

    $info = nl2br(stripslashes($row['info']));

sorry for the poor description of what i need to do

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 25 September 2006 - 10:45 AM

yes - just post it directly into a query - use addslashes if magic quotes are off!!!
follow me on twitter @PHPsycho

#3 tpfp

tpfp
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 25 September 2006 - 10:59 AM

Yeah i tried that but what happens is the table drops down for some reason half way down where its supposed to be.
is this a formatting problem ?.

Posted Image

#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 25 September 2006 - 11:03 AM

this looks more like poorly formed html - have a look at your source and see if there is an unclosed tag or something like... if the html you posted into the database is echoing out correctly then it is something to do with the parent elements

It could also be your styles if you have any...
follow me on twitter @PHPsycho

#5 tpfp

tpfp
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 25 September 2006 - 11:20 AM

Ok thanks toon I will try what you have mentioned




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users