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


Messages In This Thread
How to make a form. - by HB Virus - 12-16-2011, 04:52 AM
RE: How to make a form. - by BreShiE - 12-16-2011, 04:56 AM
RE: How to make a form. - by HB Virus - 12-16-2011, 04:58 AM
RE: How to make a form. - by King - 12-30-2011, 06:19 PM
RE: How to make a form. - by BreShiE - 12-30-2011, 07:54 PM
RE: How to make a form. - by King - 12-30-2011, 08:01 PM
RE: How to make a form. - by BreShiE - 12-16-2011, 05:03 AM
RE: How to make a form. - by HB Virus - 12-16-2011, 05:05 AM
RE: How to make a form. - by BreShiE - 12-16-2011, 05:10 AM
RE: How to make a form. - by spencerocks - 12-30-2011, 04:42 PM
RE: How to make a form. - by BreShiE - 12-30-2011, 08:03 PM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)