Jump to content

[SOLVED] Values cut short at Space


xProteuSx

Recommended Posts

I have a bunch of values in a MySQL DB and I am trying to access them and make them default values in a form using the following format:

 

<input type="text" name="edit_school" size="40" maxlength="40" value=' . $row[0] . '>

 

Now, if the value of $row[0] is, say, 'Michigan Tech' and I display it using echo $row[0]; I get the value 'Michigan Tech'.  However, when I try to display the value of $row[0] in the form using <input type="text" name="edit_school" size="40" maxlength="40" value=' . $row[0] . '> the value shown as the default value is 'Michigan'.  It seems the displayed value is always cut short following a space.

 

Please help.  I had this working, then it didn't, then it did again, and now it is not working anymore.  Its close to crazy time.  :'(

 

Link to comment
https://forums.phpfreaks.com/topic/79658-solved-values-cut-short-at-space/
Share on other sites

Ideally, you should have posted the exact PHP code you used.

 

I'm not totally understanding your problem, but look into using this function on the value:

 

http://us2.php.net/manual/en/function.urlencode.php

 

 

FYI - Other useful functions:

 

http://us2.php.net/manual/en/function.htmlentities.php

 

http://us2.php.net/manual/en/function.htmlspecialchars.php

 

http://us2.php.net/manual/en/function.nl2br.php

 

 

I finally figured it out!

 

This doesn't work:

 

<input type="text" name="edit_school" size="40" maxlength="40" value=' . $row[0] . '>

 

This does:

 

<input type="text" name="edit_school" size="40" maxlength="40" value="' . $row[0] . '">

 

It was just the extra set of quotation marks that did it.

Archived

This topic is now archived and is closed to further replies.

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