Jump to content

Guess book/ wall post


divinedesigns1
 Share

Recommended Posts

:good: 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
  • Like 1
Link to comment
Share on other sites

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.

Edited by Err
Link to comment
Share on other sites

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" :glare: silly me, but you example going to be helpful tho

Link to comment
Share on other sites

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

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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...