Values being clipped

Hi. I’m experiencing this very annoying problem. I’m reading information from the database and then putting these variable values inside form textboxes. But when it shows up inside the textbox it’s not the full text, it’s clipped. The textboxes look like this:

<input type=‘text’ name=‘pic1’ size=‘20’ maxlength=‘28’ value=’$thevalue’>

What am I doing wrong? I would really appreciate some help please

Thanks a million! :smiley: :smiley: :smiley:

Uhm, that’s probably because you set maxlength to 28 characters … also, throw an htmlentities around $thevalue before you insert it into HTML.

I don’t think the maxlength should be affecting it as the value of the $thevalue is shorter than 28 characters.

In your table, is the column type VARCHAR with a value less than the desired input?

Are you not escaping single quotes before trying to insert them: for example if your form has a field named comments, look out for this problem:

$comments = “Ain’t nobody better than my boo!”;

INSERT INTO table (id, comment) VALUES (’’, ‘$comments’)

The unescaped single quote might cause some problems.

<input type=‘text’ name=‘pic1’ size=‘20’ maxlength=‘28’ value=‘htmlentities($thevalue)’>

Did you do what djheru said? Are you sure you have at least VARCHAR(28) for that column in your db?

hello kitsunegari,

wouldn’t this create another problem?

string: “this is a test $ % # ~ & lets see what comes out" length: 56 after html entities: string: "this is a test $ % # ~&nbsp; & lets see what comes out” length: 64

just wondering!