nblackwood Posted September 7, 2009 Share Posted September 7, 2009 I posted this question earlier, but i haven't received a response and I'm kinda pressed on time. I would like to know how to post information directly to a specified table on same page without having to save it to the mysql dbase first. I know it can be done. Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/ Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 Assuming that the form uses the POST method, first you need to give it an appropriate action (so that it posts to itself: <form name='your_form' method='POST' action='<?PHP echo $_SERVER['REQUEST_URI']; ?>'> <!-- Your form fields... --> </form> Then, in the relevant table cells: <table> <tr> <td>Field 1:</td> <td><?PHP echo $_POST['field_name1']; ?></td> </tr> <tr> <td>Field 2:</td> <td><?PHP echo $_POST['field_name2']; ?></td> </tr> </table> Hope that makes sense...! Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914020 Share on other sites More sharing options...
nblackwood Posted September 7, 2009 Author Share Posted September 7, 2009 Thanks. Been searching everywhere for that. Also, forgot to mention that i want users to be able to directly edit those tables, and, i need the page to be saved as a unique php profile page for viewing by others. I am building a user profile system and have hit these little road blocks. Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914021 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 While technically that is possible (check out php.net for fopen() and fwrite()) I'm not sure why you would want to do it like that... Is there any particular reason for you not wanting to use a MySQL DB? Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914027 Share on other sites More sharing options...
bundyxc Posted September 7, 2009 Share Posted September 7, 2009 Firstly: http://tinyurl.com/n2dnes Secondly: I'd suggest an easier project. Brainstorming, developing, and maintaining a user profile system with obviously dynamic information stored on a database might be too much for you at first. I'm not sure how much experience you have coding, so please don't take this harshly. I'm trying to be helpful, not rude. Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914032 Share on other sites More sharing options...
nblackwood Posted September 7, 2009 Author Share Posted September 7, 2009 I appreciate your...concerns. I am only the developer, I don't deal with maintenance. I am familiar enough with the aspect and grandeur of user profile systems. I can program using mysql commands, I'm only exploring alternate techniques. Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914037 Share on other sites More sharing options...
RichardRotterdam Posted September 7, 2009 Share Posted September 7, 2009 I posted this question earlier, but i haven't received a response and I'm kinda pressed on time. Did you mean this thread posted a few hours ago didn't receive any responses? http://www.phpfreaks.com/forums/index.php/topic,268254.0.html Hmmm Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914038 Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 Always good to look at alternatives. It's how I learn! You're basically talking about a flat-file database over a MySQL one... You need a few things in order to do this. 1. A server that you have super user access on (or the ability to do point 2) 2. A file in a directory on said server that has RWX permissions for all users (probably just CHMOD 777) 3. Good knowledge of fopen (to open your file), fread (to read the contents of it when people are coming back) and fwrite (to add new stuff to it). w3schools has an ok tutorial on the basics of this, and would probably be a good place to start: http://www.w3schools.com/php/php_file.asp Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914042 Share on other sites More sharing options...
bundyxc Posted September 7, 2009 Share Posted September 7, 2009 So let me get this straight: You'd rather try to make your own clunky flat-file database for fun, rather than break out your self-proclaimed SQL katana and slice every obstacle in your path... even though you have an impending deadline (and obviously neither your PHP manual nor your Google works as well as ours), and you've posted two threads within a few hours trying to learn how to set a $_POST variable (which has nothing to do with impatience, I'm sure). Does that sound about right? Quote Link to comment https://forums.phpfreaks.com/topic/173390-saving-to-tables/#findComment-914046 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.