Rabu, 10 Oktober 2012

$_POST Variable


The predefined $_POST variable is used to collect values from a form sent with method="post".

Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

Example I :

Make the Example.html
<html>
<head>
<title>Blognya Anak Muda</title>
</head>

<body>
<form method="post" action="BB.php">
<table>
<tr>
<td>Name</td>
<td>:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>Age</td>
<td>:</td>
<td><input type="text" name="age"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="submit"></td>
</tr>
</table>
</form>
</body>
</html>

The Red writing that shows that it will be taken to a php form in the next example.

Blue writing that shows that the text field will be taken from previous html charging. Suppose you write the word in the text field name with the contents of "b", then the results are displayed for php form is "Your name is b".

Example II :

Make the BB.php

<title>Blognya Anak Muda</title>
Your name is <?php echo $_POST['name']; ?><br>
Your Age is <?php echo $_POST['age']; ?>

$_POST Above is the method of taking the previous html form.

Save in localhost

Tidak ada komentar: