Page 1 of 1

parse error $end

Posted: Mon Aug 02, 2010 1:47 pm
by marnieg
I am getting the error

Parse error: syntax error, unexpected $end in /mnt/w0610/d19/s13/b03253b6/www/coreknowledgeacademy.com/register.php on line 354

with my code. I have checked all } ] ) and ; statements. I have even removed chunks of php code to try and eliminate this problem. Is there an easier way to spot the real error. I have seen other postings in reference to this, but not any help. I am using Textpad for my editor.

Here is code.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Professional
Description: A two-column, fixed-width design with dark color scheme background.
Version    : 1.0
Released   : 20081230

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Register with Core Knowledge Academy</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="anylinkmenu.css" />
<script type="text/javascript" src="ajaxinclude.js"></script>

<script type="text/javascript" src="menucontents.js"></script>

<script type="text/javascript" src="anylinkmenu.js"></script>

<script type="text/javascript" src="menuanchor.js"></script>

<style type="text/css">
.style1 {
	text-align: center;
}
</style>

</head>
<body>

<div id="wrapper">

<div id="header">
	<div id="logo">
		<h1>Core Knowledge Academy</h1>
		<p>Helping Homeschoolers Succeed</p>
	</div>
	<!-- end #logo -->
	<div id="menu">
		     <script type="text/javascript">
            ajaxinclude("../includes/main.html")</script>
	</div>
	<!-- end #menu -->
</div>
<!-- end #header -->
<div id="page">
	<div id="content">
		<div class="post">
			<h1 class="title">Registration Form</h1>
			<div class="entry">
			<p>Please fill out the information required to register your
			student(s) with Core Knowledge Academy.</p>
<?php
require_once 'formvalidator.php';
$show_form=true;
if(isset($_POST['Submit']))
{
   $validator = new FormValidator();
   $validator->addValidation('username', 'req', 'Please fill in User Name');
   if($validator->ValidateForm())
   {
            // check if username entered is unique
           $newuser = $_POST['username'];
       //removed database connection information
			$query = mysql_query("SELECT COUNT(*) FROM userlogin where username = '$newuser'");
            if (mysql_num_rows($query) == 0)
            {
            // check at least mother or father has been entered
                $chkmth = $_POST['mother_lnm'];
                $chkfth = $_POST['father_lnm'];
                if (strlen($chkmth) == 0 && strlen($chkfth) == 0)
               {
                echo "Must enter one parents information";
               }
               else
               {
                //now insert data into userlogin registration and students tables
                 $newpwd = $newuser . '01^';
                 if(isset($_POST['home_school'])) {
                      $hs = 1; } else { $hs = 0; }
                  if(isset($_POST['req_std_rec'])) {
                      $stdrec = 1; } else { $stdrec = 1; }

                  $insert_user = 'insert into userlogin (username, pwd)
   			      values (
   			      "' . $newuser . '",
   			      "' . $newpwd .'")';
			      mysql_query($insert_user);
                  $insert_reg = 'insert into registration (
               	  par_user,
               	  mother_lnm,
               	  mother_fnm,
               	  mother_mi,
               	  mother_addr,
               	  mother_city,
               	  mother_st,
               	  mother_zip,
               	  mother_email,
               	  mother_ph,
               	  father_lnm,
               	  father_fnm,
               	  father_mi,
               	  father_addr,
               	  father_city,
               	  father_st,
               	  father_zip,
               	  father_email,
               	  father_ph,
               	  home_school,
               	  req_std_rec)
               	  values (
               	  "' . $_POST['username'] . '",
               	  "' . $_POST['mother_lnm'] . '",
               	  "' . $_POST['mother_fnm'] . '",
               	  "' . $_POST['mother_mi'] . '",
               	  "' . $_POST['mother_addr'] . '",
               	  "' . $_POST['mother_city'] . '",
                  "' . $_POST['mother_st'] . '",
                  "' . $_POST['mother_zip'] . '",
                  "' . $_POST['mother_email'] . '",
                  "' . $_POST['mother_ph'] . '",
                  "' . $_POST['father_lnm'] . '",
                  "' . $_POST['father_fnm'] . '",
                  "' . $_POST['father_mi'] . '",
               	  "' . $_POST['father_addr'] . '",
               	  "' . $_POST['father_city'] . '",
                  "' . $_POST['father_st'] . '",
                  "' . $_POST['father_zip'] . '",
                  "' . $_POST['father_email'] . '",
                  "' . $_POST['father_ph'] . '",
                  "' . $hs .'",
                  "' . $stdrec .'")';
                  mysql_query($insert_reg);
                  // check now for student entries and insert into students table
                  if (strlen($_POST['std1_lnm']) > 0)
                  {
                  $insert_std1 = 'insert into students
                  (par_user,
                   std_lnm,
                   std_fnm,
                   std_mi,
                   std_gender,
                   std_bdate,
                   std_grade_level,
                   std_bplace,
                   std_race,
                   sch_prev,
                   sch_prev_maddr,
                   sch_prev_city,
                   sch_prev_st,
                   sch_prev_zip)
                   values (
                    "' . $_POST['username'] . '",
                    "' . $_POST['std1_lnm'] . '",
                    "' . $_POST['std1_fnm'] . '",
                    "' . $_POST['std1_mi'] . '",
                    "' . $_POST['std1_gender'] . '",
                    "' . $_POST['std1_bdate'] . '",
                    "' . $_POST['std1_grade_level'] . '",
                    "' . $_POST['std1_bplace'] . '",
                    "' . $_POST['std1_race'] . '",
                    "' . $_POST['std1_sch_prev'] . '",
                    "' . $_POST['std1_sch_prev_maddr'] . '",
                    "' . $_POST['std1_sch_prev_city'] . '",
                    "' . $_POST['std1_sch_prev_st'] . '",
                    "' . $_POST['std1_sch_prev_zip'] . '")';
                    mysql_query($insert_std1);
                    }
                if (strlen($_POST['std2_lnm']) > 0) {
                    $insert_std2 = 'insert into students (par_user, std_lnm, std_fnm, std_mi, std_gender, std_bdate, std_grade_level,
                    std_bplace, std_race, sch_prev, sch_prev_maddr, sch_prev_city, sch_prev_st,sch_prev_zip)
                    values (
                    "' . $_POST['username'] . '",
                    "' . $_POST['std2_lnm'] . '",
                    "' . $_POST['std2_fnm'] . '",
                    "' . $_POST['std2_mi'] . '",
                    "' . $_POST['std2_gender'] . '",
                    "' . $_POST['std2_bdate'] . '",
                    "' . $_POST['std2_grade_level'] . '",
                    "' . $_POST['std2_bplace'] . '",
                    "' . $_POST['std2_race'] . '",
                    "' . $_POST['std2_sch_prev'] . '",
                    "' . $_POST['std2_sch_prev_maddr'] . '",
                    "' . $_POST['std2_sch_prev_city'] . '",
                    "' . $_POST['std2_sch_prev_st'] . '",
                    "' . $_POST['std2_sch_prev_zip'] . '")';
                    mysql_query($insert_std2);
                    }
                    $show_form=false;
              }
   }
    else
    {
       echo "<B>Validation Errors:</B>";
       $error_hash = $validator->GetErrors();
       foreach($error_hash as $inpname => $inp_err)
       {
          echo "<p>$inpname: $inp_err</p>\n";
        }
     }
}
if (true == $show_form)
{
?>
<form name='register' method='post' action=''>
<table cellspacing='1' width='95%'>
<tr>
<td><b>Choose a Username</b></td>
<td><input type='text' name='username' value='<?php echo $username; ?>' size='30'/></td></tr>
<tr><td><b>Parent Information</b></td><td><strong>Information must be entered for at least one parent</strong></td></tr>
<tr>
<td><b>Mother's Last Name*</b></td>
<td><input type='text' name='mother_lnm' value='<?php echo $mother_lnm; ?>' size='30'/></td></tr>
<tr>
<td><b>Mother's First Name</b></td>
<td><input type='text' name='mother_fnm' value='<?php echo $mother_fnm; ?>' size='20'/></td></tr>
<tr>
<td><b>Mother's Middle Initial</b></td>
<td><input type='text' name='mother_mi' value='<?php echo $mother_mi; ?>' size='2'/></td></tr>
<tr>
<td><b>Mother's Address</b></td>
<td><input type='text' name='mother_addr' value='<?php echo $mother_addr; ?>' size='50'/></td></tr>
<tr>
<td><b>City</b></td>
<td><input type='text' name='mother_city' value='<?php echo $mother_city; ?>' size='30'/> </td></tr>
<tr><td><b>State</b></td><td>
<input type='text' name='mother_st' value='<?php echo $mother_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='mother_zip' value='<?php echo $mother_zip; ?>' size='10'/></td></tr>
<tr><td>________________________</td><td>________________________________</td></tr>
<tr><td><b>Father's Last Name*</b></td>
<td><input type='text' name='father_lnm' value='<?php echo $father_lnm; ?>' size='30'/></td></tr>
<tr>
<td><b>Father's First Name</b></td>
<td><input type='text' name='father_fnm' value='<?php echo $father_fnm; ?>' size='20'/></td></tr>
<tr>
<td><b>Father's Middle Initial</b></td>
<td><input type='text' name='father_mi' value='<?php echo $father_mi; ?>' size='2'/></td></tr>
<tr>
<td><b>Father's Address</b></td>
<td><input type='text' name='father_addr' value='<?php echo $father_addr; ?>' size='50'/></td></tr>
<tr>
<td><b>City</b></td>
<td><input type='text' name='father_city' value='<?php echo $father_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='father_st' value='<?php echo $father_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='father_zip' value='<?php echo $father_zip; ?>' size='10'/></td></tr>
<tr><td>________________________</td><td>________________________________</td></tr>
<tr>
<td><strong>Will you need a request for student records?</strong></td>
<td><input name='req_std_rec' type='checkbox' <?php if($req_std_rec): ?>checked='checked'<?php endif; ?>/></td>
</tr>
<tr>
<td><strong>Is this your first time homeschooling?</strong></td>
<td><input name='home_school' type='checkbox' <?php if($home_school): ?>checked='checked'<?php endif; ?>/></td>
</tr>
</table>
<p><strong>Student 1</strong></p>
<table cellspacing='1' style='width: 95%'>
<tr><td><strong>Last Name</strong></td><td><input type='text' name='std1_lnm' value='<?php echo $std1_lnm; ?>' size='30'/></td></tr>
<tr><td><strong>First Name</strong></td><td><input type='text' name='std1_fnm' value='<?php echo $std1_fnm; ?>' size='20'/></td></tr>
<tr><td><strong>Middle Initial</strong></td><td><input type='text' name='std1_mi' value='<?php echo $std1_mi; ?>' size='2'/> </td></tr>
<tr>
<td><strong>Gender</strong></td>
<td><select name='std1_gender'>
         <option value=''>Select...</option>
         <option value='M'>Male</option>
         <option value='F'>Female</option>
      </select></td></tr>
<tr><td><strong>Birthday (Use format YYYY-MM-DD)</strong></td><td><input type='text' name='std1_bdate' value='<?php echo $std1_bdate; ?>' size='10'/> </td></tr>
<tr><td><strong>Birth Place</strong></td><td><input type='text' name='std1_bplace' value='<?php echo $std1_bplace; ?>' size='30'/> </td></tr>
<tr><td><strong>Grade Level</strong></td><td><input type='text' name='std1_grade_level' value='<?php echo $std1_grade_level; ?>' size='10'/> </td></tr>
<tr><td><strong>Race</strong></td>
      <td><select name='std1_race'>
         <option value=''>Select...</option>
         <option value='W'>White, Non-Hispanic</option>
         <option value='B'>Black, Non-Hispanic</option>
         <option value='H'>Hispanic</option>
         <option value='A'>Asian or Pacific Islander</option>
         <option value='I'>American Indian or Alaskan Native</option>
         <option value='M'>Multiracial</option>
      </select></td></tr>
<tr><td><strong>School Prev Attended</strong></td><td><input type='text' name='std1_sch_prev' value='<?php echo $std1_sch_prev; ?>' size='50'/> </td></tr>
<tr><td><strong>School Prev Address</strong></td><td><input type='text' name='std1_sch_prev_maddr' value='<?php echo $std1_sch_prev_maddr; ?>' size='50'/> </td></tr>
<tr><td><b>City</b></td>
<td><input type='text' name='std1_sch_prev_city' value='<?php echo $std1_sch_prev_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='std1_sch_prev_st' value='<?php echo $std1_sch_prev_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='std1_sch_prev_zip' value='<?php echo $std1_sch_prev_zip; ?>' size='10'/></td></tr>
</table>
<p><strong>Student 2</strong></p>
<table cellspacing='1' width='95%'>
<tr><td><strong>Last Name</strong></td><td><input type='text' name='std2_lnm' value='<?php echo $std2_lnm; ?>' size='30'/></td></tr>
<tr><td><strong>First Name</strong></td><td><input type='text' name='std2_fnm' value='<?php echo $std2_fnm; ?>' size='20'/></td></tr>
<tr><td><strong>Middle Initial</strong></td><td><input type='text' name='std2_mi' value='<?php echo $std2_mi; ?>' size='2'/> </td></tr>
<tr>
<td><strong>Gender</strong></td>
<td><select name='std2_gender'>
         <option value=''>Select...</option>
         <option value='M'>Male</option>
         <option value='F'>Female</option>
      </select></td></tr>
<tr><td><strong>Birthday (Use format YYYY-MM-DD)</strong></td><td><input type='text' name='std2_bdate' value='<?php echo $std2_bdate; ?>' size='10'/> </td></tr>
<tr><td><strong>Birth Place</strong></td><td><input type='text' name='std2_bplace' value='<?php echo $std2_bplace; ?>' size='50'/> </td></tr>
<tr><td><strong>Grade Level</strong></td><td><input type='text' name='std2_grade_level' value='<?php echo $std2_grade_level; ?>' size='10'/> </td></tr>
<tr><td><strong>Race</strong></td>
      <td><select name='std2_race'>
         <option value=''>Select...</option>
         <option value='W'>White, Non-Hispanic</option>
         <option value='B'>Black, Non-Hispanic</option>
         <option value='H'>Hispanic</option>
         <option value='A'>Asian or Pacific Islander</option>
         <option value='I'>American Indian or Alaskan Native</option>
         <option value='M'>Multiracial</option>
      </select></td></tr>
<tr><td><strong>School Prev Attended</strong></td><td><input type='text' name='std2_sch_prev' value='<?php echo $std2_sch_prev; ?>' size='50'/> </td></tr>
<tr><td><strong>School Prev Address</strong></td><td><input type='text' name='std2_sch_prev_maddr' value='<?php echo $std2_sch_prev_maddr; ?>' size='50'/> </td></tr>
<tr><td><b>City</b></td>
<td><input type='text' name='std2_sch_prev_city' value='<?php echo $std2_sch_prev_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='std2_sch_prev_st' value='<?php echo $std2_sch_prev_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='std2_sch_prev_zip' value='<?php echo $std2_sch_prev_zip; ?>' size='10'/></td></tr>
<tr>
<td colspan='2' align='center'>
<input type='submit' name='Submit' value='Submit'/></td></tr></table>
</form>
<?php
}//true== $show_form
?>
</div>
</div>
</div>
<!-- end #content -->
	<div id="sidebar">
		<div id="sidebar-bgtop"></div>
		<div id="sidebar-content">
			<div id="sidebar-bgbtm">
			<ul>
				<li>
				<h2>Registration</h2>
				<p>The basic process of registration is:</p>
				<p class='style1'>Fill out the form for your student(s). A
				password will be generated for your Account with the Username
				Entered.<br />
				<img src="images/down_arrow.jpg" width="30" height="30" /><br />
				The administrator will receive notice of your registration by
				email.<br />
				<img src="images/down_arrow.jpg" width="30" height="30" /><br />
				The administrator will contact you for payment information.<br />
				<img src="images/down_arrow.jpg" width="30" height="30" /><br />
				The administrator will activate your account and create a unique
				page for your student(s) where information will be posted.<br />
				<img src="images/down_arrow.jpg" width="30" height="30" /><br />
				You will
					receive an email from the administrator with your login
					information.<br />
				<img src="images/down_arrow.jpg" width="30" height="30" /><br />
				Now you can login with your unique account and view your student's information and related resources.
				If you have multiple students it will first ask you which
				student information you would like to view.</p>
				</li>
				<li>
				<h2>Message from Academy</h2>
				<p>We believe that loving parents are the best teachers of their children.
						We know that no education is complete that does not
						include a formal study of the Bible. The Holy Scriptures
						at an early age should be at the very core of your
						students knowledge.</p>
				</li>
			</ul>
		</div>
		</div>
	</div>
	<!-- end #sidebar -->
	<div style="clear:both; margin:0;"></div>
</div>
<!-- end #page -->
</div>
<div id="footer">
	<p>Core Knowledge Academy &copy; 2010. All Rights Reserved. <b>Design by</b>
	<a target="_blank" href="http://www.neticg.com">&#916;ICGInc.</a></p>
</div>
<!-- end #footer -->
</body>
</html>

Re: parse error $end

Posted: Mon Aug 02, 2010 3:33 pm
by califdon
I hope you will understand that I'm not going to take the time to read through your entire script. You seem to have the concept correct, there is something that isn't properly terminated. I'm not familiar with TextPad, does it have highlighting for code blocks, to make it easy to see where matching beginning and ending parentheses, braces, brackets, etc. are? If it does, you should be able to find where the missing or misplaced block ending is. If it doesn't, you might want to download PSPad, which does.

Re: parse error $end

Posted: Tue Aug 03, 2010 3:10 am
by atsa1
HUH. Messed with the code about half an hour. Checking all what might be missing. FOUND IT!
You were missing a close in code:

Code: Select all

<?php
require_once 'formvalidator.php';
$show_form=true;
if(isset($_POST['Submit']))
{ //This was not closed
Enter the close at:

Code: Select all

                    $show_form=false;
              }
   }
   } //Right here and works.
    else
    {
       echo "<B>Validation Errors:</B>";
Posting the whole fixed code below:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Professional
Description: A two-column, fixed-width design with dark color scheme background.
Version    : 1.0
Released   : 20081230

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Register with Core Knowledge Academy</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="anylinkmenu.css" />
<script type="text/javascript" src="ajaxinclude.js"></script>

<script type="text/javascript" src="menucontents.js"></script>

<script type="text/javascript" src="anylinkmenu.js"></script>

<script type="text/javascript" src="menuanchor.js"></script>

<style type="text/css">
.style1 {
        text-align: center;
}
</style>

</head>
<body>

<div id="wrapper">

<div id="header">
        <div id="logo">
                <h1>Core Knowledge Academy</h1>
                <p>Helping Homeschoolers Succeed</p>
        </div>
        <!-- end #logo -->
        <div id="menu">
                     <script type="text/javascript">
            ajaxinclude("../includes/main.html")</script>
        </div>
        <!-- end #menu -->
</div>
<!-- end #header -->
<div id="page">
        <div id="content">
                <div class="post">
                        <h1 class="title">Registration Form</h1>
                        <div class="entry">
                        <p>Please fill out the information required to register your
                        student(s) with Core Knowledge Academy.</p>
<?php
require_once 'formvalidator.php';
$show_form=true;
if(isset($_POST['Submit']))
{
   $validator = new FormValidator();
   $validator->addValidation('username', 'req', 'Please fill in User Name');
   if($validator->ValidateForm())
   {
            // check if username entered is unique
           $newuser = $_POST['username'];
       //removed database connection information
                        $query = mysql_query("SELECT COUNT(*) FROM userlogin where username = '$newuser'");
            if (mysql_num_rows($query) == 0)
            {
            // check at least mother or father has been entered
                $chkmth = $_POST['mother_lnm'];
                $chkfth = $_POST['father_lnm'];
                if (strlen($chkmth) == 0 && strlen($chkfth) == 0)
               {
                echo "Must enter one parents information";
               }
               else
               {
                //now insert data into userlogin registration and students tables
                 $newpwd = $newuser . '01^';
                 if(isset($_POST['home_school'])) {
                      $hs = 1; } else { $hs = 0; }
                  if(isset($_POST['req_std_rec'])) {
                      $stdrec = 1; } else { $stdrec = 1; }

                  $insert_user = 'insert into userlogin (username, pwd)
                              values (
                              "' . $newuser . '",
                              "' . $newpwd .'")';
                              mysql_query($insert_user);
                  $insert_reg = 'insert into registration (
                  par_user,
                  mother_lnm,
                  mother_fnm,
                  mother_mi,
                  mother_addr,
                  mother_city,
                  mother_st,
                  mother_zip,
                  mother_email,
                  mother_ph,
                  father_lnm,
                  father_fnm,
                  father_mi,
                  father_addr,
                  father_city,
                  father_st,
                  father_zip,
                  father_email,
                  father_ph,
                  home_school,
                  req_std_rec)
                  values (
                  "' . $_POST['username'] . '",
                  "' . $_POST['mother_lnm'] . '",
                  "' . $_POST['mother_fnm'] . '",
                  "' . $_POST['mother_mi'] . '",
                  "' . $_POST['mother_addr'] . '",
                  "' . $_POST['mother_city'] . '",
                  "' . $_POST['mother_st'] . '",
                  "' . $_POST['mother_zip'] . '",
                  "' . $_POST['mother_email'] . '",
                  "' . $_POST['mother_ph'] . '",
                  "' . $_POST['father_lnm'] . '",
                  "' . $_POST['father_fnm'] . '",
                  "' . $_POST['father_mi'] . '",
                  "' . $_POST['father_addr'] . '",
                  "' . $_POST['father_city'] . '",
                  "' . $_POST['father_st'] . '",
                  "' . $_POST['father_zip'] . '",
                  "' . $_POST['father_email'] . '",
                  "' . $_POST['father_ph'] . '",
                  "' . $hs .'",
                  "' . $stdrec .'")';
                  mysql_query($insert_reg);
                  // check now for student entries and insert into students table
                  if (strlen($_POST['std1_lnm']) > 0)
                  {
                  $insert_std1 = 'insert into students
                  (par_user,
                   std_lnm,
                   std_fnm,
                   std_mi,
                   std_gender,
                   std_bdate,
                   std_grade_level,
                   std_bplace,
                   std_race,
                   sch_prev,
                   sch_prev_maddr,
                   sch_prev_city,
                   sch_prev_st,
                   sch_prev_zip)
                   values (
                    "' . $_POST['username'] . '",
                    "' . $_POST['std1_lnm'] . '",
                    "' . $_POST['std1_fnm'] . '",
                    "' . $_POST['std1_mi'] . '",
                    "' . $_POST['std1_gender'] . '",
                    "' . $_POST['std1_bdate'] . '",
                    "' . $_POST['std1_grade_level'] . '",
                    "' . $_POST['std1_bplace'] . '",
                    "' . $_POST['std1_race'] . '",
                    "' . $_POST['std1_sch_prev'] . '",
                    "' . $_POST['std1_sch_prev_maddr'] . '",
                    "' . $_POST['std1_sch_prev_city'] . '",
                    "' . $_POST['std1_sch_prev_st'] . '",
                    "' . $_POST['std1_sch_prev_zip'] . '")';
                    mysql_query($insert_std1);
                    }
                if (strlen($_POST['std2_lnm']) > 0) {
                    $insert_std2 = 'insert into students (par_user, std_lnm, std_fnm, std_mi, std_gender, std_bdate, std_grade_level,
                    std_bplace, std_race, sch_prev, sch_prev_maddr, sch_prev_city, sch_prev_st,sch_prev_zip)
                    values (
                    "' . $_POST['username'] . '",
                    "' . $_POST['std2_lnm'] . '",
                    "' . $_POST['std2_fnm'] . '",
                    "' . $_POST['std2_mi'] . '",
                    "' . $_POST['std2_gender'] . '",
                    "' . $_POST['std2_bdate'] . '",
                    "' . $_POST['std2_grade_level'] . '",
                    "' . $_POST['std2_bplace'] . '",
                    "' . $_POST['std2_race'] . '",
                    "' . $_POST['std2_sch_prev'] . '",
                    "' . $_POST['std2_sch_prev_maddr'] . '",
                    "' . $_POST['std2_sch_prev_city'] . '",
                    "' . $_POST['std2_sch_prev_st'] . '",
                    "' . $_POST['std2_sch_prev_zip'] . '")';
                    mysql_query($insert_std2);
                    }
                    $show_form=false;
              }
   }
   }
    else
    {
       echo "<B>Validation Errors:</B>";
       $error_hash = $validator->GetErrors();
       foreach($error_hash as $inpname => $inp_err)
       {
          echo "<p>$inpname: $inp_err</p>\n";
        }
     }
}
if (true == $show_form)
{
?>
<form name='register' method='post' action=''>
<table cellspacing='1' width='95%'>
<tr>
<td><b>Choose a Username</b></td>
<td><input type='text' name='username' value='<?php echo $username; ?>' size='30'/></td></tr>
<tr><td><b>Parent Information</b></td><td><strong>Information must be entered for at least one parent</strong></td></tr>
<tr>
<td><b>Mother's Last Name*</b></td>
<td><input type='text' name='mother_lnm' value='<?php echo $mother_lnm; ?>' size='30'/></td></tr>
<tr>
<td><b>Mother's First Name</b></td>
<td><input type='text' name='mother_fnm' value='<?php echo $mother_fnm; ?>' size='20'/></td></tr>
<tr>
<td><b>Mother's Middle Initial</b></td>
<td><input type='text' name='mother_mi' value='<?php echo $mother_mi; ?>' size='2'/></td></tr>
<tr>
<td><b>Mother's Address</b></td>
<td><input type='text' name='mother_addr' value='<?php echo $mother_addr; ?>' size='50'/></td></tr>
<tr>
<td><b>City</b></td>
<td><input type='text' name='mother_city' value='<?php echo $mother_city; ?>' size='30'/> </td></tr>
<tr><td><b>State</b></td><td>
<input type='text' name='mother_st' value='<?php echo $mother_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='mother_zip' value='<?php echo $mother_zip; ?>' size='10'/></td></tr>
<tr><td>________________________</td><td>________________________________</td></tr>
<tr><td><b>Father's Last Name*</b></td>
<td><input type='text' name='father_lnm' value='<?php echo $father_lnm; ?>' size='30'/></td></tr>
<tr>
<td><b>Father's First Name</b></td>
<td><input type='text' name='father_fnm' value='<?php echo $father_fnm; ?>' size='20'/></td></tr>
<tr>
<td><b>Father's Middle Initial</b></td>
<td><input type='text' name='father_mi' value='<?php echo $father_mi; ?>' size='2'/></td></tr>
<tr>
<td><b>Father's Address</b></td>
<td><input type='text' name='father_addr' value='<?php echo $father_addr; ?>' size='50'/></td></tr>
<tr>
<td><b>City</b></td>
<td><input type='text' name='father_city' value='<?php echo $father_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='father_st' value='<?php echo $father_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='father_zip' value='<?php echo $father_zip; ?>' size='10'/></td></tr>
<tr><td>________________________</td><td>________________________________</td></tr>
<tr>
<td><strong>Will you need a request for student records?</strong></td>
<td><input name='req_std_rec' type='checkbox' <?php if($req_std_rec): ?>checked='checked'<?php endif; ?>/></td>
</tr>
<tr>
<td><strong>Is this your first time homeschooling?</strong></td>
<td><input name='home_school' type='checkbox' <?php if($home_school): ?>checked='checked'<?php endif; ?>/></td>
</tr>
</table>
<p><strong>Student 1</strong></p>
<table cellspacing='1' style='width: 95%'>
<tr><td><strong>Last Name</strong></td><td><input type='text' name='std1_lnm' value='<?php echo $std1_lnm; ?>' size='30'/></td></tr>
<tr><td><strong>First Name</strong></td><td><input type='text' name='std1_fnm' value='<?php echo $std1_fnm; ?>' size='20'/></td></tr>
<tr><td><strong>Middle Initial</strong></td><td><input type='text' name='std1_mi' value='<?php echo $std1_mi; ?>' size='2'/> </td></tr>
<tr>
<td><strong>Gender</strong></td>
<td><select name='std1_gender'>
         <option value=''>Select...</option>
         <option value='M'>Male</option>
         <option value='F'>Female</option>
      </select></td></tr>
<tr><td><strong>Birthday (Use format YYYY-MM-DD)</strong></td><td><input type='text' name='std1_bdate' value='<?php echo $std1_bdate; ?>' size='10'/> </td></tr>
<tr><td><strong>Birth Place</strong></td><td><input type='text' name='std1_bplace' value='<?php echo $std1_bplace; ?>' size='30'/> </td></tr>
<tr><td><strong>Grade Level</strong></td><td><input type='text' name='std1_grade_level' value='<?php echo $std1_grade_level; ?>' size='10'/> </td></tr>
<tr><td><strong>Race</strong></td>
      <td><select name='std1_race'>
         <option value=''>Select...</option>
         <option value='W'>White, Non-Hispanic</option>
         <option value='B'>Black, Non-Hispanic</option>
         <option value='H'>Hispanic</option>
         <option value='A'>Asian or Pacific Islander</option>
         <option value='I'>American Indian or Alaskan Native</option>
         <option value='M'>Multiracial</option>
      </select></td></tr>
<tr><td><strong>School Prev Attended</strong></td><td><input type='text' name='std1_sch_prev' value='<?php echo $std1_sch_prev; ?>' size='50'/> </td></tr>
<tr><td><strong>School Prev Address</strong></td><td><input type='text' name='std1_sch_prev_maddr' value='<?php echo $std1_sch_prev_maddr; ?>' size='50'/> </td></tr>
<tr><td><b>City</b></td>
<td><input type='text' name='std1_sch_prev_city' value='<?php echo $std1_sch_prev_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='std1_sch_prev_st' value='<?php echo $std1_sch_prev_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='std1_sch_prev_zip' value='<?php echo $std1_sch_prev_zip; ?>' size='10'/></td></tr>
</table>
<p><strong>Student 2</strong></p>
<table cellspacing='1' width='95%'>
<tr><td><strong>Last Name</strong></td><td><input type='text' name='std2_lnm' value='<?php echo $std2_lnm; ?>' size='30'/></td></tr>
<tr><td><strong>First Name</strong></td><td><input type='text' name='std2_fnm' value='<?php echo $std2_fnm; ?>' size='20'/></td></tr>
<tr><td><strong>Middle Initial</strong></td><td><input type='text' name='std2_mi' value='<?php echo $std2_mi; ?>' size='2'/> </td></tr>
<tr>
<td><strong>Gender</strong></td>
<td><select name='std2_gender'>
         <option value=''>Select...</option>
         <option value='M'>Male</option>
         <option value='F'>Female</option>
      </select></td></tr>
<tr><td><strong>Birthday (Use format YYYY-MM-DD)</strong></td><td><input type='text' name='std2_bdate' value='<?php echo $std2_bdate; ?>' size='10'/> </td></tr>
<tr><td><strong>Birth Place</strong></td><td><input type='text' name='std2_bplace' value='<?php echo $std2_bplace; ?>' size='50'/> </td></tr>
<tr><td><strong>Grade Level</strong></td><td><input type='text' name='std2_grade_level' value='<?php echo $std2_grade_level; ?>' size='10'/> </td></tr>
<tr><td><strong>Race</strong></td>
      <td><select name='std2_race'>
         <option value=''>Select...</option>
         <option value='W'>White, Non-Hispanic</option>
         <option value='B'>Black, Non-Hispanic</option>
         <option value='H'>Hispanic</option>
         <option value='A'>Asian or Pacific Islander</option>
         <option value='I'>American Indian or Alaskan Native</option>
         <option value='M'>Multiracial</option>
      </select></td></tr>
<tr><td><strong>School Prev Attended</strong></td><td><input type='text' name='std2_sch_prev' value='<?php echo $std2_sch_prev; ?>' size='50'/> </td></tr>
<tr><td><strong>School Prev Address</strong></td><td><input type='text' name='std2_sch_prev_maddr' value='<?php echo $std2_sch_prev_maddr; ?>' size='50'/> </td></tr>
<tr><td><b>City</b></td>
<td><input type='text' name='std2_sch_prev_city' value='<?php echo $std2_sch_prev_city; ?>' size='30'/></td></tr>
<tr>
<td><b>State</b></td>
<td><input type='text' name='std2_sch_prev_st' value='<?php echo $std2_sch_prev_st; ?>' size='2'/><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip:</strong>
<input type='text' name='std2_sch_prev_zip' value='<?php echo $std2_sch_prev_zip; ?>' size='10'/></td></tr>
<tr>
<td colspan='2' align='center'>
<input type='submit' name='Submit' value='Submit'/></td></tr></table>
</form>
<?php
}//true== $show_form
?>
</div>
</div>
</div>
<!-- end #content -->
        <div id="sidebar">
                <div id="sidebar-bgtop"></div>
                <div id="sidebar-content">
                        <div id="sidebar-bgbtm">
                        <ul>
                                <li>
                                <h2>Registration</h2>
                                <p>The basic process of registration is:</p>
                                <p class='style1'>Fill out the form for your student(s). A
                                password will be generated for your Account with the Username
                                Entered.<br />
                                <img src="images/down_arrow.jpg" width="30" height="30" /><br />
                                The administrator will receive notice of your registration by
                                email.<br />
                                <img src="images/down_arrow.jpg" width="30" height="30" /><br />
                                The administrator will contact you for payment information.<br />
                                <img src="images/down_arrow.jpg" width="30" height="30" /><br />
                                The administrator will activate your account and create a unique
                                page for your student(s) where information will be posted.<br />
                                <img src="images/down_arrow.jpg" width="30" height="30" /><br />
                                You will
                                        receive an email from the administrator with your login
                                        information.<br />
                                <img src="images/down_arrow.jpg" width="30" height="30" /><br />
                                Now you can login with your unique account and view your student's information and related resources.
                                If you have multiple students it will first ask you which
                                student information you would like to view.</p>
                                </li>
                                <li>
                                <h2>Message from Academy</h2>
                                <p>We believe that loving parents are the best teachers of their children.
                                                We know that no education is complete that does not
                                                include a formal study of the Bible. The Holy Scriptures
                                                at an early age should be at the very core of your
                                                students knowledge.</p>
                                </li>
                        </ul>
                </div>
                </div>
        </div>
        <!-- end #sidebar -->
        <div style="clear:both; margin:0;"></div>
</div>
<!-- end #page -->
</div>
<div id="footer">
        <p>Core Knowledge Academy &copy; 2010. All Rights Reserved. <b>Design by</b>
        <a target="_blank" href="http://www.neticg.com">&#916;ICGInc.</a></p>
</div>
<!-- end #footer -->
</body>
</html>

Re: parse error $end

Posted: Tue Aug 03, 2010 9:03 am
by marnieg
Thank you for the find. Also I did download PSPad and will see if that helps in the future. Textpad does do some coloring between php and html but not with syntax.

Re: parse error $end

Posted: Wed Aug 04, 2010 1:16 am
by atsa1
Well i use http://sourceforge.net/projects/notepad2
This is best for Highlighting the code. You can chose different highlight colours but default will be good for html/PHP.

When you have open { it's blue colour. When everithing is OK and you have closed { } both of them should be RED.