Jump to content
Larry Ullman's Book Forums

Recommended Posts

After a long absense, I've decided to try to once again get my head around php.  I have made to chapter 6 but seem to have an issue that I cannot debug.  Was wondering if someone could have a look at my code to see what I am missing or doing wrong?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTDxhtml1-transitional.dtd"><html xmlns="http:///www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv-"content-type" content="text/html; charset=utf-8"/>
<title>Registration Form</title>
<!-- register.html -->
<div><p style="font-size:20px"><strong>Please fill out this form to register:</strong></p>
<form action="handle_reg.php" method="post">
<p>Email Address: <input type="text" name="email" size="30" /></p>
<p>Password: <input type="password" name="password" size="20" /></p>
<p>Confirm Password: <input type="password" name="confirm" size="20" /></p>
<p>Year You Were Born: <input type="text" name="year" value="YYYY" size="4" /></p>
<p>Favorite Color: <select name="color"><option value="">Pick One</option><option value="red">Red</option><option value="yellow">Yellow</option>
<option value="green">Green</option><option value="blue">Blue</option></select></p>
<p><input type="checkbox" name="terms" value="yes" /> I agree to the terms (whatever they may be).</p>

<input type="submit" name="submit" value="Register" />


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<h1>Registration Results</h1>
<?php // Script 6.2 - handle_reg.php
/* This script receives seven values from register.html:
email, password, confirm, year, terms, color, submit */

// Address error management, if you want.

// Flag variable to track success:
$okay = TRUE;

// If there were no errors, print a success message:
if ($okay) {
	print '<p>You have been successfully registered (but not really).</p>';

Here is what I see when filling out the form:



I am using wamp with apache 2.4.33, php 7.2.4 and mysql 5.7.21

Edited by nootkan
added server details
Link to post
Share on other sites

Okay I was able to figure out what I did wrong. It seems that somehow I managed to call the scripts in the browers with c:/ instead of http://localhost.  Not sure when or how that happened as I usually just reopen the browser from my last session.  In any case, I'm good to go on. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...