Skip to content

Instantly share code, notes, and snippets.

@msomu
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save msomu/48aa936a216c29e8173e to your computer and use it in GitHub Desktop.

Select an option

Save msomu/48aa936a216c29e8173e to your computer and use it in GitHub Desktop.
This is a PHP simple file that sends data from html to php
<html>
<head>
<title>
This is an php tutorial
</title>
</head>
<body>
<form action="learnphp.php" method="post">
<table border="0">
<tr>
<td>Name</td>
<td align="center"><input type="text" name="username" size="30" /></td>
</tr>
<tr>
<td>Address</td>
<td align="center"><input type="text" name="streetaddress" size="30" /></td>
</tr>
<tr>
<td>City</td>
<td align="center"><input type="text" name="cityaddress" size="30" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title>Information Gathered</title>
</head>
<body>
<?php
define('PI', 3.14);
echo "The value of PI is" . PI;
echo "</br> 5 + 2 =" . (5 + 2);
echo "</br> 5 - 2 =" . (5 - 2);
echo "</br> 5 * 2 =" . (5 * 2);
echo "</br> 5 / 2 =" . (integer)(5 / 2);
echo "</br> 5 % 2 =" . (5 % 2);
$usersName=$_POST['username'];
$streetAddress=$_POST['streetaddress'];
$cityAddress=$_POST['cityaddress'];
echo $usersName . "</br>";
echo $streetAddress . "</br>";
echo $cityAddress . "</br>";
$str = <<<EOD
The coustomer name is $usersName and he lives in $streetAddress at $cityAddress </br>
EOD;
echo $str;
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment