Jump to content

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


Chips

Recommended Posts

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:
[code]
<tr><td>Last Name:</td><td><input type='text' value='<?php echo $rows['lname']; ?>' name='lnameEDIT'/></td></tr>
[/code]

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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