jacko_162 Posted January 7, 2008 Share Posted January 7, 2008 i hope this makes sense, i am starting to create my own mini CMS system and i have run in to a strange problem. i have a page where the user can add catagories, and a page to add a product where you can select which catagory it belongs to. now when i add a product with a the following info; ================= Product Name: Test Catagory: Fish Price: £2.50 ================= everything works fine, but if i add a product with; ================= Product Name: Test Catagory: Soft Corals Price: £2.50 ================= it doesnt add "Soft coral" to the product, instead it just adds "Soft" it discounts the space and the word coral?! is there something i have done wrong? I use a drop down menu for the catagory select method and it pulls the catagory list from the catagory table in the DB. the catagory field type is "mediumtext" I hope i can fix this issue as its driving me nuts.. Quote Link to comment https://forums.phpfreaks.com/topic/84943-solved-small-error/ Share on other sites More sharing options...
teng84 Posted January 7, 2008 Share Posted January 7, 2008 can we see you drop menu form? Quote Link to comment https://forums.phpfreaks.com/topic/84943-solved-small-error/#findComment-433121 Share on other sites More sharing options...
jacko_162 Posted January 7, 2008 Author Share Posted January 7, 2008 sure; <td><select name="catagory"> <? // Query to pull information from the "catagory" Database $result = mysql_query("select * from $table13 order by id DESC"); while ($row = mysql_fetch_object($result)){ ?> <option value=<?php echo $row->name; ?>> <?php echo $row->name; ?> </option> <?}?> </select></td> thats for just the dropdown, and i use this for the INSERT: // Query for insert $sql = "INSERT INTO $table1 (name, make, catagory, price, description, sold, colour) VALUES ('$name', '$make', '$catagory', '$price', '$description', '$sold', '$colour')"; $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/84943-solved-small-error/#findComment-433126 Share on other sites More sharing options...
teng84 Posted January 7, 2008 Share Posted January 7, 2008 add " on your option values <option value="<?php echo $row->name; ?>"> <?php echo $row->name; ?> not sure but i guess that is the prob your getting an html problem not php Quote Link to comment https://forums.phpfreaks.com/topic/84943-solved-small-error/#findComment-433128 Share on other sites More sharing options...
jacko_162 Posted January 8, 2008 Author Share Posted January 8, 2008 thank you, that worked a treat. Quote Link to comment https://forums.phpfreaks.com/topic/84943-solved-small-error/#findComment-433137 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.