I want to put some type of input on my website where people can submit questions, reviews, and other things. I've seen some codes for it but i don't understand what it does. What does it do when they submit something? How do i get it? Thanks for your help!
thanks for the reply but after i add that code, what do i do with it? I don't see what happens when somebody types something in and clicks on "submit". It would probably help if you could explain it to me like i was a 5 year old.
__________________
www.geocities.com/home_page5 - Visit this site for Fitness Articles, Cheap Supplements, and Free Ebooks.
the form (what miseria posted) is the script that should be in your html file. this is what the user sees when they view your website and it has the boxes where they can type in their info.
now in "whatever.php", you have to have the script that you want to execute using the information that was put into the form. and where it says method="whatever", use method="post".
for example, say you have a form that asks for their name. they type in their name and press submit. then whatever that is typed into the box is sent to the .php file to execute. now in this script, you can use the information. ill show you how to make the page say "Hello, (person name)". heres the code for the html page where they would type in their name.
<?php
$name=$_POST['name']; //define the variable that was sent via the form
$write="Hello, ";
$write.=$name; //make a variable of what you want to say
echo($write); //display what you want written
?>
now theyll see a page saying "Hello, NAME"
you can also do a LOT more with forms, and once you learn MySQL, it becomes invaluable. hope i helped. if you have any more questions, just ask.
<?php
if($_POST['submit']) //Check to see if they actually hit submit :D
{
$name=$_POST['name']; //define the variable that was sent via the form
$write="Hello, ";
$write.=$name; //make a variable of what you want to say
echo($write); //display what you want written
}
else
{//whoops, they reached this page without submitting the form
die("You are not supposed to see this page!");
}
?>
That way, no data is displayed etc unless the person has "Submitted" the form
I tried the code that was posted and it didnt really work...i dont think that my host supports php. Is there any way to do it without using php, perl ect? All i want to do is let people type in reviews of a product and send them to me somehow. Thanks for the help
__________________
www.geocities.com/home_page5 - Visit this site for Fitness Articles, Cheap Supplements, and Free Ebooks.
well if ur host doesnt support PHP, you can always make a file called test.php and put this in it:
PHP Code:
<? phpinfo(); ?>
itll tell u if php is supported or not. i dont think you can do that without a server side script. javascript MIGHT be able to do it, but i dont think so (dont know javascript). i suggest a better host