Jump to content


Photo

Inserting a value from a database into input field *SOLVED*


  • Please log in to reply
No replies to this topic

#1 Chips

Chips
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 26 June 2006 - 09:44 AM

EDIT: Fixed it myself, stupid mistake of not thinking :/ Obviously value=" <?php blah blah ?>" solves it. What a numpty.


My issue lies with inserting a value from the database into a value for an input field - as so:
<tr><td>Last Name:</td><td><input type='text' value='<?php echo $rows['lname']; ?>' name='lnameEDIT'/></td></tr>

The issue is that when I am obtaining a value from the database that includes a ' character, it cuts off the value right there. If I echo the value to the page, it comes out correctly (as in o'neil), but if I try to put the value of the input field as (o'neil), it just get (o)... effectively disregarding everything after the ' character.

I cannot find out how to output the field value with this character, tried using addslashes, but it adds a slash, but still cuts off everything from ' onwards.

Has anyone got any suggestions/work arounds. I think its with the input field not taking a ' in a value, not php itself - just looking for a solution!

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users