Pages - Menu

Pages

Wednesday, 26 March 2014


Bab 11

PHP Forms and User Input

 

Perintah $_GET dan $_POST digunakan untuk mengirim informasi dari form, seperti input user.

 

Program11-1.php

<html>
<body>
<form action="Program11-2.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>

 

Program11-2.php

<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>

 

output:

Welcome John.
You are 28 years old.

 

No comments:

Post a Comment