nickholt1972 Posted August 6, 2006 Share Posted August 6, 2006 I'm setting up an online shop and I want to be able to edit the product descriptions. So i've set up an edit form but when I bring the relevant data into my form all the data [b]after the first space [/b] is ignored.The following is an example of one of the form fields.<div id="label"><label>Product Descrition:</div><div id="input"><input type="text" name="description" size="50" value=<?php echo $description; ?> /></label></div>I've tried testing [b]echo $description [/b] outside of the form and it displays the data perfectly.Just to further clarify, the data in the database may read "This is a great Product" but when I display the form for the web administrator to edit the text, it will just say [b]"This"[/b].Its obviously something very simple - it always is, but i've exhausted all other resources - can anyone help?Thanks,Nick Quote Link to comment Share on other sites More sharing options...
Orio Posted August 6, 2006 Share Posted August 6, 2006 Let's say $description="one two three". When php echo's this string- this is the output:<input type="text" name="description" size="50" value=one two three />When the browser goes over the code he doest understand to what the "two three" part belongs, so he ignores it. The solution will be adding quotes. Change your code to the following:<input type="text" name="description" size="50" value=[b]"[/b]<?php echo $description; ?>[b]"[/b] />(Notice the qoutes around the value of "value")Orio. Quote Link to comment Share on other sites More sharing options...
nickholt1972 Posted August 6, 2006 Author Share Posted August 6, 2006 Orio, dude, You rule!Thanks very much for that. Like I said, the solution is so simple - especially when you explain it aswell.This learning curve is steep - but its great fun, and forums like this are invaluable.Thanks again man.Nick. 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.