ikmyer Posted May 3, 2007 Share Posted May 3, 2007 I suppose this question very well could go in the HTML sections but my problem really comes along with storing data an using php to display it. I have a edit form that gets populated with data from a Database and the input field may contain " or ' So I run into a problem with the page is created when this instance comes along and the " or ' ends the value="abcd" tag in the input field. example: Here is the php line <input name="question" type="text" id="question" value="<?php echo $row_question_edit['question']; ?>" size="90" /> Here is the html from the line above... <input name="question" type="text" id="question" value="Complete the following statement "Objectives be added in PXT --------"" size="90" /> Notice how the whole Value= should be "Complete the following statement "Objectives be added in PXT --------"" but the " right after the word statement ends the value= tag Any way to get around this besides not allowing " or ' to be stored ? Thanks ! Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/ Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 <input name="question" type="text" id="question" value="Complete the following statement "Objectives be added in PXT --------"" size="90" /> Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/#findComment-244272 Share on other sites More sharing options...
ikmyer Posted May 3, 2007 Author Share Posted May 3, 2007 Thank you... Would you or anyone know of the ( or have a ) php function that turns " into " Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/#findComment-244276 Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 <input name="question" type="text" id="question" value="<?php echo "Complete the following statement \"Objectives be added in PXT --------\";?>" size="90" /> Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/#findComment-244277 Share on other sites More sharing options...
ikmyer Posted May 3, 2007 Author Share Posted May 3, 2007 the \ will not work... I will have to store " in the database instead of storing " So on the insert i need to convert " into " I think i should be able to find the search and replace function of php... Thank you for pointing me in the right direction !! Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/#findComment-244286 Share on other sites More sharing options...
ikmyer Posted May 3, 2007 Author Share Posted May 3, 2007 I found what I was looking for. htmlentities($str, ENT_QUOTES) All is working perfect now. Thanks again jitesh Link to comment https://forums.phpfreaks.com/topic/49800-solved-input-field-initial-value-with/#findComment-244302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.