I have a form that gathers information in a textarea. I want to convert the line breaks (\n or \r) to some html code using a javascript and store that into a column in a mySQL table. I have done a similar thing with flat files and perl where I converted the line break to a [br] and then replaced the [br] with <br> just before the perl print statement.
Before I waist a bunch of time trying different things, what do I need to know.
Mainly what I'm gathering is a lunch menu and I want to display the information in an html table. I'd could use an <li> but I want it to wrap indented and if I don't use a <ul> around the <li>s then it doesn't indent the way I want BUT then it's indented too much and space is precious on this, so I was just going to put a table in that displayed the lines:
[FONT=courier new]
<table border="1" bordercolor="#000000" cellpadding="3" cellspacing="0" width="100%">
<tr class="blk"><td colspan="5">Lunch Menu</td></tr>
<tr class="blk"><td colspan="5">Week of date1 - date5</td></tr>
<tr class="gld">
<td>Monday<br>date1</td>
<td>Tuesday<br>date2</td>
<td>Wednesday<br>date3</td>
<td>Thursday<br>date4</td>
<td>Friday<br>date5</td>
</tr>
<tr>
<td class="txtBL14L">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td valign="top">•</td><td valign="top">item 1 menu1</td></tr>
<tr><td valign="top">•</td><td valign="top">item 2 menu1</td></tr>
<tr><td valign="top">•</td><td valign="top">item 3 menu1</td></tr>
</table>
</td>
<td class="txtBL14L">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td valign="top">•</td><td valign="top">item 1 menu2</td></tr>
<tr><td valign="top">•</td><td valign="top">item 2 menu2</td></tr>
<tr><td valign="top">•</td><td valign="top">item 3 menu2</td></tr>
</table>
</td>
<td class="txtBL14L">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td valign="top">•</td><td valign="top">item 1 menu3</td></tr>
<tr><td valign="top">•</td><td valign="top">item 2 menu3</td></tr>
<tr><td valign="top">•</td><td valign="top">item 3 menu3</td></tr>
</table>
</td>
<td class="txtBL14L">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td valign="top">•</td><td valign="top">item 1 menu4</td></tr>
<tr><td valign="top">•</td><td valign="top">item 2 menu4</td></tr>
<tr><td valign="top">•</td><td valign="top">item 3 menu4</td></tr>
</table>
</td>
<td class="txtBL14L">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr><td valign="top">•</td><td valign="top">item 1 menu5</td></tr>
<tr><td valign="top">•</td><td valign="top">item 2 menu5</td></tr>
<tr><td valign="top">•</td><td valign="top">item 3 menu5</td></tr>
</table>
</td>
</tr>
</table>
[/FONT]
So, what that means is that the line break would be replaced with:
[FONT=courier new]</td></tr><tr><td valign="top">•</td><td valign="top">[/FONT]
I guess the other alternative would be to do the html on the back end and enter a delimiter of some sort (, or | maybe) in place of the line break and sort it all out when I pull the column. Would I need to escape the pipe (|) if I used that?
What's the recommendation here?
Thanks,
Alisa