logicopinion Posted February 13, 2008 Share Posted February 13, 2008 hey. using this code i want to print out the content of the databse in forms where i can edit them and then update again <form action="index.php?p=itm1" method="post"> <table border="0" cellpading="1" cellspacing="0"> <TR><TD height="50" class="titles" colspan="3" align="center"> თუ გსურსთ მენიუს დაამატოთ ახალი ჩანართი, ჩაწერეთ ახალი ჩანართის სახელი</TD></TR> <?php include("includes/vars.php"); mysql_connect("$hostname", "$username", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $query = "SELECT * FROM $navigation ORDER BY id ASC"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { print "<form ection=\"update_menu.php\ method=\"post\">"; print "<table class='titles' border='0' cellpadding='0' cellspacing='0' width='100%'>"; print "<TR><TD style=\"BORDER-TOP:1px #f9f9f9 solid; BORDER-BOTTOM:1px #f9f9f9 solid; BORDER-RIGHT:1px #f9f9f9 solid; BORDER-LEFT:1px #f9f9f9 solid;\"; height=\"30\"><input class=\"login\" type=\"text\" size=\"50\" value=".$row['item']."></TD></TR>"; print "</table>"; } ?> when i tried just to echo to row['item'] everything was fine but now i am trying to output them in a form where it can be edited.. and here it comes with an error. this is the list of the names of links which are listed on my web pages navigation menu. forexaple > news > staff > bulletin board > etc.. and when i output this items using echo they are choed as they are in database... (some of them consist of two words (bulletin board) forexample) but when i output them in a form. like this <input type=\"text\" value=".$row['item']."> it comes whith such error. if using comand echo "bulletin board was echoed" in form instead of "bulletin boar" only word bulletin is echoed.. mean second word is lost somewhere... have no idea why? any suggestations? thank you Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/ Share on other sites More sharing options...
Isityou Posted February 13, 2008 Share Posted February 13, 2008 Make sure you escape characters that may effect the output. Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466166 Share on other sites More sharing options...
logicopinion Posted February 13, 2008 Author Share Posted February 13, 2008 i realy can`t understan escapinig characters meaning, could u explane in an example please? thank you Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466168 Share on other sites More sharing options...
Isityou Posted February 13, 2008 Share Posted February 13, 2008 // Will convert HTML tags to html character codes echo htmlentities(output); Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466170 Share on other sites More sharing options...
logicopinion Posted February 13, 2008 Author Share Posted February 13, 2008 yes its clear about ECHO but what about this one? <input type=\"text\" value=".$row['item']."> Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466174 Share on other sites More sharing options...
logicopinion Posted February 13, 2008 Author Share Posted February 13, 2008 Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466192 Share on other sites More sharing options...
Isityou Posted February 13, 2008 Share Posted February 13, 2008 <input type=\"text\" value=".htmlentities($row['item'])."> Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466197 Share on other sites More sharing options...
logicopinion Posted February 13, 2008 Author Share Posted February 13, 2008 á��á�£á� á��á��á��á�£á��á�� thats what the content of the form looks like after adding htmlentities to it. is not the reason of that i use georgian unicode utf-8 ? Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-466208 Share on other sites More sharing options...
logicopinion Posted February 15, 2008 Author Share Posted February 15, 2008 no sugestsations about it? Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-467905 Share on other sites More sharing options...
craygo Posted February 15, 2008 Share Posted February 15, 2008 If there is a space in the name you have to enclose it in quotes <input class=\"login\" type=\"text\" size=\"50\" value=\"".$row['item']."\"> also you may want to give the input a name or pretty much going to be useless Ray Quote Link to comment https://forums.phpfreaks.com/topic/90957-outputting-db-content-in-a-form/#findComment-467912 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.