Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make a form.
#1
Forms are used to send date to the file.

Methods

POST
A post method posts to the php file and you can't see anything by the eye.
GET
A get method sends the user to the php file like file.php?eg=thereinput

So lets get to the coding of the form.

Code
PHP Code:
<form action="" method="GET">
<
b>Username: </b><br><input type="text" name="username"><br>
<
input type="submit">
</
form>
<?
if(isset(
$_GET['username'])){
$username $_GET['username'];
echo 
"The username you put is: " .$username;
}
?>

Now let me show you what etch line does.
<form action="" method="GET">
Starting the form saying action = to... What php file the form sends to.
Method = meaning the method so post or get.

<b>Username: </b><br><input type="text" name="username"><br>
Inputing text and a textbox for the user to enter there username.
<input type="submit">
Inputing a submit button.
</form>
Ending the forum.
<?
Starting the php tag
if(isset($_GET['username'])){
Meaning if link has a get method in with the value username then so the script.
$username = $_GET['username'];
Grabbing what the user inputed in the textbox before.
echo "The username you put is: " .$username;
Showing on there screen that text.
}
Ending the if
?>
Ending the php tags.


If you need any help with this fell free to pm me.

Reply
#2
Please take a look at the forums before posting, I already have a similar tutorial in here, I recommend you read THIS before continuing. Also, don't forget to read the rules. Proof reading always helps too, you have allot of grammatical errors in there.
Reply
#3
(12-16-2011, 04:56 AM)BreShiE Wrote: Please take a look at the forums before posting, I already have a similar tutorial in here, I recommend you read THIS before continuing. Also, don't forget to read the rules. Proof reading always helps too, you have allot of grammatical errors in there.

Well two will be okay, and i'm so tired i'll do it latter.
Reply
#4
Two what will be okay? You're too tired to do what? Please be clearer.
Reply
#5
(12-16-2011, 05:03 AM)BreShiE Wrote: Two what will be okay? You're too tired to do what? Please be clearer.

Two tuts on this, and i'm to tried to fix my grammar errors.
Reply
#6
What's the point in having two tutorials for the same thing? That's so illogical. (Don't mind me I'm a bit hyped up about today so I like using big words, just ignore it haha)

But yeah, nice tutorial I guess, some things are a bit hard to understand but never the less quite good! You should add into the OP THIS THREAD to explain to people what the IF statement does.

Reply
#7
I like to use www.jotform.com because it is secure, otherwise there are a HANDFUL of things that hackers can do to your fields.
Reply
#8
(12-16-2011, 04:56 AM)BreShiE Wrote: Please take a look at the forums before posting, I already have a similar tutorial in here, I recommend you read THIS before continuing. Also, don't forget to read the rules. Proof reading always helps too, you have allot of grammatical errors in there.

I am so sorry. I couldn't resist, but you have a spelling error in there also. Pinch

Reply
#9
(12-30-2011, 06:19 PM)King Wrote: I am so sorry. I couldn't resist, but you have a spelling error in there also. Pinch


Where? I don't see any?

Everything is fine as far as I can see.
Reply
#10
(12-30-2011, 07:54 PM)BreShiE Wrote: Where? I don't see any?

Everything is fine as far as I can see.

Third one down.

http://david.tribble.com/text/misspell.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP email input form - having trouble getting the form to work... abayindi 4 2,395 03-19-2012, 10:02 AM
Last Post: RainbowDashFTW
  [NEED HELP] PHP Form post, get, echo Đενɨаηсε™ 5 1,800 02-06-2012, 01:16 PM
Last Post: ★Cooldude★
  PHP form creator? Sam 7 2,264 07-13-2011, 04:53 AM
Last Post: Skyset
  [SOLVED] HTML Form + PHP Help! J4P4NM4N 1 973 04-11-2011, 06:04 AM
Last Post: J4P4NM4N
  Basic form question. Frank Yates 2 990 03-06-2011, 11:54 AM
Last Post: Frank Yates

Forum Jump:


Users browsing this thread: 1 Guest(s)