divinedesigns1 Posted April 16, 2012 Share Posted April 16, 2012 morning all,ok im thinking about making a app where you can post a comment on the website, but im stuck at how you get the text that is submit to the wall, do i have to, post the variable to echo below the form ? like what facebook, twitter, etc have Link to comment Share on other sites More sharing options...
Err Posted April 16, 2012 Share Posted April 16, 2012 This is a very simple example: <form action="" method="post"> <input type="text" name="txtNam" value="" /></form> The PHP for this would be (on the same page where the form exists): <?php $nam = $_POST['txtNam']; echo $nam;?> Note that the "name" attribute inside the <input> tag is being used by PHP. PHP sees the name attribute and uses to reference the form and it's value. Then I grab the POST value and assign it to my own variable $nam, you can use $_POST['txtNam'] itself instead of using $nam but it's easier to type $nam than it is to type $_POST['txtNam'], no? After I do that, I echo $nam. The echo makes it display on the page. So now you should be able to see the value you put on the form box, on the page. I should note that this will normally only last for one page.If you want a small comment area or guest book, then you will have to save the data submitted somewhere and keep it stored so you don't lose what was submitted. If it's sensitive data people usually use a database like MySQL otherwise you can use a simple text file and save the submitted values there.A bit of advice: As long as people can freely submit data to your website that is later displayed on your website, I would strip out any HTML or at least render their HTML useless by using the htmlentities() function. Also, you may want to record their ips in case they decide to spam messages. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 16, 2012 Author Share Posted April 16, 2012 thanks Err, and yea i would have to use a database then call onto that table which is storing the variable $nam information to echo out on the wall/page "i figured it out after thinking about it" silly me, but you example going to be helpful tho Link to comment Share on other sites More sharing options...
Err Posted April 16, 2012 Share Posted April 16, 2012 If you need more help on the subject you can refer to this thread:http://w3schools.invisionzone.com/index.php?showtopic=12509It's very helpful with basic php stuff. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 16, 2012 Author Share Posted April 16, 2012 If you need more help on the subject you can refer to this thread:http://w3schools.inv...showtopic=12509 It's very helpful with basic php stuff. alright kool, will do, soon as i write down everything i need for this website 0.o recreating this one www.divinedesigns1.net but im thinking about moving this template www.divinedesigns1.com to the .net and recreating the .com instead, what you think? Link to comment Share on other sites More sharing options...
Err Posted April 16, 2012 Share Posted April 16, 2012 I'm not sure. I'm bad at design stuff, taking suggestions from me about websites as a whole is generally a bad idea, ask me anything about coding though and I don't do so bad. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 16, 2012 Author Share Posted April 16, 2012 I'm not sure. I'm bad at design stuff, taking suggestions from me about websites as a whole is generally a bad idea, ask me anything about coding though and I don't do so bad. lol, i feel you on that one, but your example is a good one minus theres no submit button but then again we can make it so that they "enter" button is use as the submit button instead Link to comment Share on other sites More sharing options...
Err Posted April 16, 2012 Share Posted April 16, 2012 When I posted that it was 2am, sometimes things slip my mind. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted April 16, 2012 Author Share Posted April 16, 2012 When I posted that it was 2am, sometimes things slip my mind. i know how that is also, i be doing the same thing and when i read it after i wake up i be like wth is thifushhd lmfaooo, im famous for sleep texting lol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.