bradkenyon Posted February 20, 2008 Share Posted February 20, 2008 $imgurl = '<img src="/images/icons/img.jpg">'; doctypes = array(array("label"=>"(select type)","value"=>""), array("label"=>"A4","value"=>"$imgurl")); i am trying to output the drop down w/ select type, and A4, but A4 has the value of <img src="/images/icons/img.jpg">, but it stores that value in the db as <img src= also, in the drop down, it lists A4, and adds a bit of the html into the drop down field, as you'll see in the image. this is the html of it in the source code: <select name='D_doctype' size='1' /><option value="">(select type)</option> <option value="<img src="/images/icons/img.jpg">">A4</option> </select> does anyone know why it only stores <img src= in the db table, i put addslashes around it when its inserted into the database, as well as why the html source code is being displayed funny in the drop down, but looks fine in the source code. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 20, 2008 Share Posted February 20, 2008 Because once it reaches that second quote, it thinks the value attribute is done. You need to encode the value getting put there like this: <option value="<?php echo htmlspecialchars($imgurl); ?>">A4</option> Quote Link to comment Share on other sites More sharing options...
bradkenyon Posted February 20, 2008 Author Share Posted February 20, 2008 got it thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.