Jump to content

[SOLVED] simple but frustrating - echoing within value=' on form


DamienRoche

Recommended Posts

I have a form that has several preset values using value=' or " within an input field.

 

Problem is, if I use ', then I can't use ' within the value and same for ".

 

I can't escape the output because it's useless with slashes in the value. I need it as it is in the database.

 

Is there any way around this?

 


#NO SLASHES - doesn't show anything between two ' ' or after 1.

<input type="text" name="q" value='<?php echo $fetchq['q'];?>'/>

#SLAHES - shows everything but obviously is escaped.

<input type="text" name="q" value='<?php echo addslashes($fetchq['q']);?>'/>

 

Any help is greatly appreciated. Thanks.

Thank you so much. Wow, this is pretty basic stuff. I thought I'd mastered forms and echoing data. Just never really had to use it I guess.

 

Good security measure as well. Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.