CammyD Posted February 23, 2008 Share Posted February 23, 2008 Hi Php newbie here. I need some help with a project i am working on. It is a kind of Multi Person notepad, so it takes the text you type, saves it, then echos it on the index page. What i am stuck on here is the <textarea> part. On that bit, you type in the stuff, hit submit, gets saved then takes you back to the index. I want to make the textarea echo what is already in the database. Example: ________ | | | | <-- Text box Index.php --> Saved text | | How do i make what shows up on the index file, show up in the text box? Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/ Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 You can do that by doing something like this $texte = @current(@mysql_fetch_assoc(@mysql_query("SELECT * FROM tableWHERE this='that"))); echo '<textarea rows="2" name="name" cols="20">'.$texte.'</textarea>'; Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474121 Share on other sites More sharing options...
CammyD Posted February 23, 2008 Author Share Posted February 23, 2008 EDIT: Here is the .zip file that i have made up: www.cambiker.com/help.zip Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474126 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 <?php include="info.php"; $name_of_table=""; $the_where_definition="this='that'"; ?> <form action="process.php" method="post"> <textarea name="text"> <?php echo @current(@mysql_fetch_assoc(@mysql_query("SELECT * FROM $name_of_table WHERE $the_where_definition"))); ?> </textarea> </br><input type="submit" /> </form> Just change the 2 vars on top for the name of the table and the where definition Ex id='1' Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474131 Share on other sites More sharing options...
CammyD Posted February 23, 2008 Author Share Posted February 23, 2008 I still can't get that working. Here is my MySQL info: Database: Text Table: My_table Feild: Text Can you have a look at that zip file? Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474134 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 Can you be more specific ... what's the error you get where is the error located what is the where definition you used ... Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474136 Share on other sites More sharing options...
CammyD Posted February 23, 2008 Author Share Posted February 23, 2008 <?php include="info.php"; $name_of_table="my_table"; $the_where_definition="??'"; ?> <form action="process.php" method="post"> <textarea name="text"> <?php echo @current(@mysql_fetch_assoc(@mysql_query("SELECT * FROM $name_of_table WHERE $the_where_definition"))); ?> </textarea> </br><input type="submit" /> </form> I don't get the $the_where_definition bit When i hit submit, the text on the index is blank Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474138 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 if you wana show the stuff in your text area you have to tell him where to find it. most tables has a unique var we call id so you should start by finding out if you have one on your table. Let say you do have the id var to your table and you would like to see the row id number 5 in your textarea you would use id='5' Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474145 Share on other sites More sharing options...
CammyD Posted February 23, 2008 Author Share Posted February 23, 2008 Sorry, you have lost me. I will look for help elsewhere Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474152 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 Sorry CammyD i tryed to explain this as much as i can lol but if you wana do this you need some basics ... You should start by tutorials on MySQL SELECT Quote Link to comment https://forums.phpfreaks.com/topic/92528-help-with-forms/#findComment-474206 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.