0

Hello i have a textarea on a form when i submit it it returns [object HTMLTextAreaElement] so does on the field of the table. WHat can i do to fix it?

2
Contributors
2
Replies
14
Views
3 Years
Discussion Span
Last Post by SimonIoa
0

It sounds like you are passing the object itself around rather than the text it holds. Got some code you can post up?

0

yes

this is the textarea
<textarea name="update_text_descr" id="update_text_descr" ></textarea>

this is the .js file

var update_audio_descr=$("#update_text_descr").val();

var dataString = 'update_text='+ updateval+'&uploads='+X+'&update_text_descr='+update_text_descr+'&text_sample='+text_sample;

$.ajax(
        {
            type: "POST",
            url: "message_ajax.php",
            data: dataString,
            cache: false,
            success: function(html)
            {
                $("#flash").fadeOut('fast');
                $("#content").prepend(html);
                $("#update_text").val('').focus();  
                $('#preview_text_photo').html('');
                $('#uploadvalues_text').val('');
                $('#textphoto').val('');
                $('#text_sample').val('');
                var c=$('#update_count').html();
                $('#update_count').html(parseInt(c)+1);
                parent.$.colorbox.close();
            }
        });

and this is the .php file

$update=mysql_real_escape_string($_POST['update_text']);
$update_description=mysql_real_escape_string($_POST['update_text_descr']);
$text_sample=mysql_real_escape_string($_POST['text_sample']);
$uploads=$_POST['uploads'];
$type = 'T';
$data=$Wall->Insert_Update($uid, $update, $uploads, $type, $text_sample, $update_description);


public function Insert_Update($uid, $update, $uploads, $type, $text_sample, $update_description)
    {
        $update=mysql_real_escape_string($update);
        $update_description=mysql_real_escape_string($update_description);
        $text_sample=mysql_real_escape_string($text_sample);
        $type=mysql_real_escape_string($type);

        $time=time();
        $ip=$_SERVER['REMOTE_ADDR'];
        $query = mysql_query("SELECT msg_id, message FROM `messages` WHERE uid_fk='$uid' order by msg_id desc limit 1") or die(mysql_error());
        $result = mysql_fetch_array($query);    
        if ($update!=$result['message'])
        {
            $uploads_array=explode(',',$uploads);
            $uploads=implode(',',array_unique($uploads_array));

            $query = mysql_query("INSERT INTO `messages` (message, description, uid_fk, ip, created, uploads, text, type) VALUES ('$update', '$update_description', '$uid', '$ip', '$time', '$uploads', '$text_sample', '$type')") or die(mysql_error());
            $v = mysql_query("UPDATE `users` SET updates_count=updates_count+1 WHERE uid='$uid'") or die(mysql_error());
            $newquery = mysql_query("SELECT M.msg_id, M.uid_fk, M.message, M.created,M.uploads,M.text,M.type,M.Believe_count,M.Review_count,M.Suggest_count,U.username FROM messages M, users U where M.uid_fk=U.uid and M.uid_fk='$uid' order by M.msg_id desc limit 1 ");
            $result = mysql_fetch_array($newquery);
            return $result;
        } 
        else
        {
            return false;
        }   
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.