Dynadot โ€” .com Registration $8.99

PHP Help Please..

Spaceship Spaceship
Watch

Coolprogram

Established Member
Impact
7
I need some PHP help.I need to know how to submit forms.cause i know how to make forms.But for some reason it willnot let me submit forms. :| :| So really nee someones help on this.I need to have a form because it will make my site a lot better.Thank you very very very very much
-Coolprogram
P.S I am using a webhosting server for the php stuff i know for a fact it works :P
if that makes a difference.
Thanks Again
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
It's very simple ;)

form:
Code:
<form method="post" action="scriptname.php">
<input type="text" name="variable1"><br />
<input type="text" name="variable2"><br />
<input type="Submit" name="Submit" value="Submit">
</form>

ok, so you got your form, you know that already :P

when the form is submitted via the submit button, the values from the fields in the form will be translated in PHP to this:
PHP:
$_POST['variable1']
$_POST['variable2']
$_POST['Submit']
The submit button also submits a value to PHP. This will be an easy method for checking if a user hit the submit button.

heres a small script that just shows the data the user submitted
PHP:
<?php

// This checks if the user submitted.
// The word in parentheses must equal the value that you assigned the Submit button
if ($_POST['Submit'] == "Submit")
{
    // anything in here you do if the user submitted the form
    echo "Variable 1 is: ".$_POST['variable1']."<br />";
    echo "Variable 2 is: ".$_POST['variable2']."<br />";
}
else
{
    // This area is for if the user didn't submit. The else statement IS optional. It isn't needed.
    // You could just as easily leave it out and just have the form show no matter what.
}
?>


Hope this helps ;)

Also, one more thing. the words inside the $_POST are the names that you assign the fields in the form. So if you had this:
Code:
<input type="text" name="trees">
then the PHP code would be
PHP:
$_POST['trees']
 
0
•••
You forgot to put semicolons at the end of the lines in your $_POST code!!
 
0
•••
I know, they were just to show the format (when there were only the $_POST[] variables inside the PHP tags...)
 
0
•••
Okay that helps.But i dont think it works on webhosting things because i havew a web hosting thing i use it for but it doesnt work when i put the codes there it gives a cannot find thing.So what does that mean :-/.Thanks for the help.
Coolprogram
 
0
•••
Cannot find what?
 
0
•••
Cannot find the Page it's on even though it's on the same page and everything or it cant find the PHP files.........What does it mean :-/:-/:-/
Thanks again for the help coolprogram
 
0
•••
Would help if you could copy+paste the error ;) Make sure your form action is the same as the PHP script filename.
 
0
•••
been there tryed that it is ecactly right ;)
 
0
•••
You mean that was the problem? *lol* okay :D
 
0
•••
heh ;) lol but what is my problem is what i am trying to figure out!!!!!!!!! :) :-/
 
0
•••
Oh, you didn't solve it? :P um.... please! Do the following:

When the error appears, highlight it. Press Ctrl+C. When you come to reply, press Ctrl+V to paste the error.

Then we can help you more!
 
0
•••
Hi ppl,

I just wanted to know it's not necessary to put the $_POST['submit'];
on the receiveing end is it?

coolprogram, I think you might be using an earlier version of php which takes
in commands like HTTP_POST_VARS['name']; or you might be looking in the
wrong directory.these are just guesses sorry If Im wrong I kinda new to php
programming but have experience In other languages.
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back