Jump to content

[SOLVED] strlen help


dennismonsewicz

Recommended Posts

I have a script that reads the length of a string coming out of a database and based on the length is how long the input field is to edit that particular field. But the problem i am having is its not accurately sizing the input field correctly

 

$testimonialLength = strlen($row->testimonial);

 

Any ideas?

 

The input is like this:

 

<input class="inputbox" type="text" name="testimonial" id="testimonial" size="<?php echo $testimonialLength; ?>" value="<?php echo $row->testimonial; ?>" />

Link to comment
Share on other sites

Yeah.  You might want to use CSS if you want to more accurately control the width of the text box.

 

<input class="inputbox" type="text" name="testimonial" id="testimonial" style=width: "<?php echo $testimonialLength * 12; ?>px" value="<?php echo $row->testimonial; ?>" />

Link to comment
Share on other sites

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.