textarea data
Moderator: General Moderators
- cbcampbell
- Forum Newbie
- Posts: 19
- Joined: Mon Jun 09, 2003 12:12 am
textarea data
i am having trouble getting a textarea box in a form to output it's data to a mysql database. all my regular form INPUT boxes work just fine, but the data from the text area box doesn't go to the assigned field like with the other one line INPUT fields.
Here is an example of my one line INPUT box...
<input name="call_phone" type="text" size="13" maxlength="12">
and here is the TEXTAREA box...
<textarea name="call_mess"></textarea>
and here is the php/mysql that puts it into the database...
$query = "INSERT INTO callog VALUES ('',NOW(),'$call_to','$call_first','$call_last','$call_phone','$call_mess')";
all the other fields go into the databse correctly, except for the textarea. Is there something I'm missing?
Here is an example of my one line INPUT box...
<input name="call_phone" type="text" size="13" maxlength="12">
and here is the TEXTAREA box...
<textarea name="call_mess"></textarea>
and here is the php/mysql that puts it into the database...
$query = "INSERT INTO callog VALUES ('',NOW(),'$call_to','$call_first','$call_last','$call_phone','$call_mess')";
all the other fields go into the databse correctly, except for the textarea. Is there something I'm missing?
- cbcampbell
- Forum Newbie
- Posts: 19
- Joined: Mon Jun 09, 2003 12:12 am
it worked....i don't know what i did differently. Oh, while I'm at it, is there anyway to format the output of the textarea so that say when i prematurely start a new line it will have the line breaks in the output:
***example input into the textarea box****
this is a wonderful
test message
**************
***the output i get from the textarea box****
this is a wonderful test message
**************
***the output i want from the textarea box*******
this is a wonderful
test message
**************
thank you all so much for your help...I just love forums!
***example input into the textarea box****
this is a wonderful
test message
**************
***the output i get from the textarea box****
this is a wonderful test message
**************
***the output i want from the textarea box*******
this is a wonderful
test message
**************
thank you all so much for your help...I just love forums!
Have you tried changing the names?
So instead of
try
So instead of
Code: Select all
<input name="call_phone" type="text" size="13" maxlength="12">
and here is the TEXTAREA box...
<textarea name="call_mess"></textarea>Code: Select all
<input name="callphone" type="text" size="13" maxlength="12">
and here is the TEXTAREA box...
<textarea name="callmess"></textarea>Try:
Code: Select all
<textarea name="call_mess" wrap="physical"></textarea>Or maybe:
As the wrap attribute is not standard compliant.
Code: Select all
<textarea name="call_mess" style="white-space: pre"></textarea>- cbcampbell
- Forum Newbie
- Posts: 19
- Joined: Mon Jun 09, 2003 12:12 am
i tried the wrap....it formats it correctly in the actual database...but it doesn't when i output it to my php webpage....
any other suggestions?
Code: Select all
$query="SELECT * FROM callog ORDER BY call_date DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center><font size='6'>The Call Log</font></center></b><br><br>";
$i=0;
while ($i < $num) {
$call_to=mysql_result($result,$i,"call_to");
$call_date=mysql_result($result,$i,"call_date");
$call_first=mysql_result($result,$i,"call_first");
$call_last=mysql_result($result,$i,"call_last");
$call_phone=mysql_result($result,$i,"call_phone");
$call_mess=mysql_result($result,$i,"call_mess");
echo "<b>$call_last, $call_first</b><br><u>TO</u>: $call_to<br><u>Date</u>: $call_date<br><u>Phone</u>: $call_phone<br><u>Message</u>: $call_mess<br><hr><br>";That's cause it's storing the newlines as \n's which are not displayed in HTML.
try doing:
try doing:
Code: Select all
<?php
echo "<b>$call_last, $call_first</b><br><u>TO</u>: $call_to<br><u>Date</u>: $call_date<br><u>Phone</u>: $call_phone<br><u>Message</u>: ".nl2br($call_mess)."<br><hr><br>";
?>- cbcampbell
- Forum Newbie
- Posts: 19
- Joined: Mon Jun 09, 2003 12:12 am