Ezilon.com - Target Your Audience, be Seen in Your Region

Display the data in the text box but not allow the user to edit it?

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 107 posts

Joined: Mar 2006

Is it possible to diable a textbox so the user can't edit the value or copy it? I want to be able to display the data in the text box (from the database) but not allow the user to edit it. How can I do this? Confused

Busy's picture
Modrater

He has: 6,148 posts

Joined: May 2001

place this in the tag

readonly="readonly"

like so:

<?php
echo stripslashes($description);
?>

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

He has: 107 posts

Joined: Mar 2006

Thanks, can the stripslashes be used in asp? I have fields the user enters data into and sometimes if they put too many //// it gives an SQL error, how can I make these inputboxs SQL injection proof etc? is the stripslashes a way of doing this?

Is there a way to do this without javascript? like using a label?

Busy's picture
Modrater

He has: 6,148 posts

Joined: May 2001

Sorry I do not know asp

stripslashes is from the database, addslashes would be to enter into database, but thats php

a label just labels the field, readonly isn't javascript, other option is just plain ole text

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

mscreashuns's picture

He has: 529 posts

Joined: Jul 2005

You could also use:

... disabled="disabled" ...

'

instead of the readonly option, although I've never understood the difference.