I am attempting to create a shared grocery list webapp as a way to learn HTML and PHP. I am attempting to follow these directions to create my item addition form.
I am trying to get my page to show the submitted data under the form as a proof of concept, but nothing will display. This is my code, saved in \XAMPP\htdocs\ :
<html>
<head>
<title>Grocery List</title>
</head>
<body>
<?php
$category = $item = "";
?>
<form id='additem' method='post'>
<fieldset>
<legend>Add Item</legend>
<table>
<tr>
<td><label for='Category'>Category: </label></td>
<td><input type='text' name='Category' list='categories' value='<?php echo $category;?>' /></td>
<datalist id='categories'>
<option value='Protein'>
<option value='Produce'>
<option value='Baked Goods'>
<option value='Dry/Canned'>
<option value='Household'>
</datalist>
</tr><tr>
<td><label for='item'>Name: </label></td>
<td><input type='text' name='item' value='<?php echo $item;?>' /></td>
</tr><tr>
<td></td><td><input type='Submit' value='Submit' /></td>
</tr>
</table>
</fieldset>
</form>
<?php
echo "Your Input:";
echo $category;
echo $item;
?>
but when I open that page in my browser and input some information all I get is "Your Input:" followed by empty space where my info should be output.
Can anybody see where I am going wrong?