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
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

 

 

Link to comment
Share on other sites

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.

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.