LJ Archive

Listing 1. getnamenum.php3

<HTML><BODY>
<?php
// this comment will not be passed to the browser
// or interpreted
echo "Hello, User<P>"; // simple echo of string
echo "What is your name?<P>";
echo "<FORM action=\"respond.php3\"
METHOD=GET>";
echo "First Name: <Input TYPE=Text Name=\"fname\" > <BR>";
//note quotes within quotes are escaped with a
//backslash
echo "Last Name: <Input TYPE=Text Name=\"lname\" > <BR>";
echo "Enter two numbers to add: <Input TYPE=Text Name=\"x\">";
echo "<Input TYPE=Text Name=\"y\"><BR>";
echo "<Input TYPE=SUBMIT name=\"enter\" value=\"enter\">";
echo "</FORM>";
?>
</HTML></BODY>

respond.php3

<HTML><BODY>
<?php
echo "Hello again, $fname $lname<P>"; // echo of
                            // cgi vars passed in
$z=$x+$y;                   // perform calculation
echo "$x + $y = $z !";
?>
</HTML></BODY>
LJ Archive