This weekend I decided to learn PHP, so I purchased the book Murach’s PHP and MySQL. XAMPP seems to have installed just fine. Some general example pages with php includes or calls to a database work without issue.
But as I’ve followed the tutorials, I’ve found some files that do not execute as expected. They are provided with the book, and I’m at a loss to understand where the problem is. As a novice, I don’t know if I should be looking at XAMPP, my version of PHP (which is 5.3.5), the database, or the code itself. Since it came with the book, I thought the code should be just fine.
One of these example files should yield a page that has empty text boxes, which will then be populated with data by the user. The problem is that when the page loads, the text boxes themselves are not empty. They have error codes within them. Followed by error codes outside of the boxes as well.
Here is the code for that page:
Future Value CalculatorFuture Value Calculator
<?php if (!empty($error_message)) { ?><?php echo $error_message; ?>
<?php } // end if ?> <div id="data">
<label>Investment Amount:</label>
<input type="text" name="investment"
value="<?php echo $investment; ?>"/><br />
<label>Yearly Interest Rate:</label>
<input type="text" name="interest_rate"
value="<?php echo $interest_rate; ?>"/><br />
<label>Number of Years:</label>
<input type="text" name="years"
value="<?php echo $years; ?>"/><br />
</div>
<div id="buttons">
<label> </label>
<input type="submit" value="Calculate"/><br />
</div>
</form>
</div>
The error within the one of the text boxes is as follows: