Jump to content

[SOLVED] unexpected $end error


Winston_Smith

Recommended Posts

This is my first try with PHP, no prior programming experience. I'm making an application to help me with a pre-registration that I'm in charge of. I've programmed a page with forms for entering the data with forms into a database. That part worked ok, now I'm trying to get the page to display the entered information in tables. I've been trying to figure out what is wrong with this for a few hours now, still no luck.

 

<?php
//Connect to Database
mysql_connect("localhost", "root", "123456") or die(mysql_error());
mysql_select_db("ecfiber") or die(mysql_error());
//Set variables
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$town = $_POST['town'];
$mail = $_POST['mail'];

// Insert data into ecfiber table
mysql_query("INSERT INTO ecfiber 
(fname, lname, address, town, mail) VALUES('$fname', '$lname', '$address', '$town', '$mail') ") 
or die(mysql_error());  
//Print table
print <<<_HTML_
<table width="800" border="0">
  <tr>
    <th scope="col">First Name</th>
    <th scope="col">Last Name</th>
    <th scope="col">E-911Address</th>
    <th scope="col">Town</th>
    <th scope="col">E-Mail</th>
  </tr>
  _HTML_;
  print "<tr><td>";
  print $fname;
  print "</td><td>";
  print $lname;
  print "</td><td>";
  print address;
  print "</td><td>";
  print $town;
  print "</td><td>";
  print $mail;
  print "</td></tr>";
  print "</table>";


print "Data inserted into table please select one of the below options <br>";
print "<a href = \"index.html\"> Return To Main Index</a><br>";
print "<a href = \"listdb.php\">View Database</a>";
?>

 

The error i'm getting is this

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\ecfiber\PHP\data.php on line 45

 

 

Thanks for any help

 

Link to comment
https://forums.phpfreaks.com/topic/119933-solved-unexpected-end-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.