Jump to content

Recommended Posts

Hey guys,

 

I'm fairly new to php, but i have this basic question and i do mean easy.

 

I have an edit form that get its information from an id that is passed to it once you find the record you wanna edit.

 

Then with the information it fills out the form, the trouble is on the input type = text fields if that field has a space in it, it will cut of there.

 

I have done an echo of the field just to make sure its getting the data fine and it is, it has the problem when i use

 

value = <?php echo "$a_row[0]"; ?>

 

and if a_row[0] was say "John Smith" it would say John in the text field.

 

Any help would be great other fields such as text areas contain the spaces fine.

 

Thanks again guys, sorry if this is on the wrong forum.

 

 

Link to comment
https://forums.phpfreaks.com/topic/142756-text-input-cutting-off-at-white-space/
Share on other sites

Edit: Basically the same info+ as above ^^^

 

Correct HTML has quotes around the value="..." value. You also need to use htmlentities on the data before/when you echo it so that HTML special characters in it won't break the HTML. And you don't need double-quotes around a php variable unless you have something else inside of the string.

 

value = "<?php echo htmlentities($a_row[0]); ?>"

 

 

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.