Link to home
Start Free TrialLog in
Avatar of Simon336697
Simon336697Flag for Australia

asked on

Grabbing posted variables and echoing in a TEXTAREA element

Hi guys hope you are all well.
Guys im having a problem.
I can retrieve tha value of a form variable, but I cannot echo it and display it in a TEXTAREA element.
Should you be able to do this?
When I change the element from a TEXTAREA element to an input type=text box, I can see it.
Im wondering because i thought there was a limit on the number of characters you can have in an input box.
Any help greatly appreciated.
Avatar of bansidhar
bansidhar
Flag of India image

can you post the code how you are doing it?
I don't know what is the textarea limit but it is more than 64k.
Avatar of Simon336697

ASKER

Hi ban, thank you mate i will right now :>)
SOLUTION
Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

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
Basically, this is what im having problems with:

showtasks_select_v5.php
     posts to
edit_task.php

=================================================== showtasks_select_v5.php
<form name="formedit" method="post" action="edit_task.php">      
<input type="radio" name="radioedittask" value="<?php echo $rows_view_tasks['id_ctk']; ?>">
<input type="hidden" name="hiddendescription" value="<?php echo $rows_view_tasks['description_ctk']; ?>">
</form>

Just before the above form, I have the following..

==========================================================================
<tr>      
<td id="viewtasksid"><?php echo $rows_view_tasks['id_ctk']; ?></td>
<td id="viewtasksname"><a href="<?php echo $query_string_page; ?>" target="_blank"><?php echo $rows_view_tasks['name_ctk']; ?></a></td>
<td id="viewtasksproject"><?php echo $rows_view_tasks['name_pro']; ?></td>
<td id="viewtasksdescription"><?php echo $rows_view_tasks['description_ctk']; ?></td>
<td id="viewtasksradio">                                    
<form name="formedit" method="post" action="edit_task.php">      
<input type="radio" name="radioedittask" value="<?php echo $rows_view_tasks['id_ctk']; ?>">
<input type="hidden" name="hiddendescription" value="<?php echo $rows_view_tasks['description_ctk']; ?>">                                    
</td>      
</tr>

====================
Ban, in the above, I can see the following on this page..

<td id="viewtasksdescription"><?php echo $rows_view_tasks['description_ctk']; ?></td>

So, what I dont understand is when i post to edit_page.php, the following...

<input type="hidden" name="hiddendescription" value="<?php echo $rows_view_tasks['description_ctk']; ?>">

and then in edit_page.php try and grab the value of hiddendescription, it is blank.

      $grab_hiddendescription = $_POST['hiddendescription'];
      echo "The value of \$grab_hiddendescription is: " . $grab_hiddendescription;
Hi mm, in my other page that i use to insert tasks, i just have the following..

<td class="descriptioncol2"><textarea name="description" type="text" id="description"></textarea></td>
<input type="submit" name="Submit" value="Insert New Task">

Should i be formatting what goes into this textarea section?

try
<input type="hidden" name="hiddendescription" value="<?php echo htmlspecialchars($rows_view_tasks['description_ctk']); ?>">
and for text area the syntax is
<textarea name="description" cols="30" rows="10" id="description"></textarea>

there is no attribute "type" for textarea

you have to format if you are storing it to mysql database, you have to use mysql_real_escape_string()
Hi ban,
I am storing it in a mysql database....
You guys are the best...

All i am using at the moment ban is the following for inserting records into mysql:

insert_task.php posts to insert_task_ac.php which inserts the data.....

========================================================== insert_task.php
<form name="form1" method="post" action="insert_task_ac.php">
<textarea name="description"  id="description"></textarea></td>
<input type="submit" name="Submit" value="Insert New Task">
</form>

========================================================== insert_task_ac.php
$sql="INSERT INTO $tbl_tasks(name_ctk, fk_id_pro_ctk, description_ctk)VALUES('$taskname', '$project', '$description')";
$result=mysql_query($sql);


Ban, how would i incorporate the use of mysql_real_escape_string()
to make sure what the user entered in the textarea wasa "safe" to enter into the database?

You guys have been so generous cant thank you enough.
In insert_tasks_ac.php, im just grabbing the data for the textarea by doing:

$description=$_POST['description'];
ASKER CERTIFIED SOLUTION
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
Thanks ban and MM......and sorry for doubling up it wont happen again.
Im going to give you guys the points now and work on this some more.
Your help has been invaluable i cant thank you enough.
if it's not too late, I'd just give all the points to ban, they did all the conversing, I just asked a question :P

either way, glad you got it all working.