Aims:
$qty, $QTY and
$Qty are different
answer1.php: a script that uses a variable
<body>
<?php
$answer = 'Forty-two.';
echo '<p>What is the answer to Life, the Universe, and Everything?</p>';
echo '<p>';
echo $answer;
echo '</p>';
?>
</body>
$answer = 'Forty-two.';
$answer = 'Forty-two.';
$my_age = $answer;
$greeting = 'Hello ' . 'world';
answer2.php: another script that uses a variable
<body>
<?php
$answer = 'You\'re not going to like it.';
echo '<p>What is the answer to Life, the Universe, and Everything?</p>';
echo '<p>';
echo $answer;
echo '</p>';
$answer = 'Forty-two.';
echo '<p>What is the answer to Life, the Universe, and Everything?</p>';
echo '<p>';
echo $answer;
echo '</p>';
?>
</body>
form.html contains this form:
<form action="process.php" method="get">
<input type="text" name="firstname" />
<input type="text" name="surname" />
<input type="submit" />
</form>
GET process.php?firstname=Hugh&surname=Jeegoh
process.php: a script that greets you by name
<body>
<?php
$firstname = $_GET['firstname'];
$surname = $_GET['surname'];
echo '<p>';
echo 'Hello ';
echo $firstname;
echo ' ';
echo $surname;
echo '</p>';
?>
</body>
process.php$_GET allows you to access the data that was entered into the
form and sent in the request
name
attribute from the form
home.html contains this form:
<form action="display_home.php" method="get">
<input type="text" name="town" />
<input type="text" name="county" />
<input type="submit" />
</form>
display_home.php, which displays a paragraph such as
(in my case):