xProteuSx Posted December 1, 2007 Share Posted December 1, 2007 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. :'( Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted December 1, 2007 Share Posted December 1, 2007 post the entire script, or at least a big chunk of the script so that we can better check for errors or solutions. Quote Link to comment Share on other sites More sharing options...
toplay Posted December 1, 2007 Share Posted December 1, 2007 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 Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted December 1, 2007 Share Posted December 1, 2007 im not the best out there but try this : <input type=\"text\" name=\"edit_school\" size=\"40\" maxlength=\"40\" value=\"$row[0]\"> might work might not. sorry Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted December 1, 2007 Author Share Posted December 1, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.