Jump to content

Recommended Posts

Hi

 

Data is entered directly into the database (phpMyAdmin). When this data then is then looked up on the website, it shows only a part of the first line as the table is too small. The textarea must be dynamic as texts vary in size.

 

Does anyone have a good idea how this problem can be solved best?

 

Dok2.doc

<tr>
   <td input type="textarea" class="fieldset"><div class="tbl_lbl">FUND STRATEGY</div>
    <div class="tbl_input">
	 <input size="57" name="fund_strategy" id="fund_strategy"
	  value="<?php echo $arrayFund[0]['fund_strategy']?></textarea>
    </div></td>
  </tr>

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/272308-problem-with-textarea/
Share on other sites

<tr>
<td input type="textarea" class="fieldset"><div class="tbl_lbl">FUND STRATEGY</div>
<div class="tbl_input">
<input size="57" name="fund_strategy" id="fund_strategy"
value="<?php echo $arrayFund[0]['fund_strategy']?></textarea>
</div></td>
</tr>

 

That looks confusing as hell? Shouldn't it be more like this?

 

<tr>
<td class="fieldset">
<div class="tbl_lbl">FUND STRATEGY</div>
<div class="tbl_input">
<textarea size="57" name="fund_strategy" id="fund_strategy">
<?php echo $arrayFund[0]['fund_strategy']?>
</textarea>
</div>
</td>
</tr>

Yes, I know... I am working on it, though. But still, even when I try to increase the textarea, it stays the same. I tried this <textarea width="300px" name="fund_strategy" id="fund_strategy"> and how can I get the text from database inside this textarea field?

So, I finally thought I have found some code to expand the textarea dynamically. But no... anyway, here's the javascript code to this textarea. If someone has got a code that works, please let me know. Thanks

 

<tr>

<td class="fieldset">

<div class="tbl_lbl">FUND STRATEGY</div>

<div class="tbl_input">

<textarea id="fund_strategy" onkeyup="new do_resize(this);" cols="43" rows="1" name="fund_strategy">

<?php echo $arrayFund[0]['fund_strategy']?></textarea>

</textarea>

</div>

</td>

</tr>

 

function do_resize(textbox) {
var maxrows=5;
var txt=textbox.value;
var cols=textbox.cols;
var arraytxt=textbox.split('\n');
var rows=arraytxt.length;
for (i=0;imaxrows)
textbox.rows=maxrows;
else
textbox.rows=rows;
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.