Winston_Smith Posted August 16, 2008 Share Posted August 16, 2008 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 More sharing options...
kenrbnsn Posted August 16, 2008 Share Posted August 16, 2008 When you use the "heredoc" syntax "<<<_HTML", the string that indicates the end of the input, in your case "_HTML_", must be the only thing on a line with nothing before it. Ken Link to comment https://forums.phpfreaks.com/topic/119933-solved-unexpected-end-error/#findComment-617811 Share on other sites More sharing options...
Winston_Smith Posted August 16, 2008 Author Share Posted August 16, 2008 Thanks, I knew it was something simple. Link to comment https://forums.phpfreaks.com/topic/119933-solved-unexpected-end-error/#findComment-617812 Share on other sites More sharing options...
revraz Posted August 16, 2008 Share Posted August 16, 2008 May want to fix this too print address; to print $address; Link to comment https://forums.phpfreaks.com/topic/119933-solved-unexpected-end-error/#findComment-617813 Share on other sites More sharing options...
Winston_Smith Posted August 16, 2008 Author Share Posted August 16, 2008 Yes thank you Link to comment https://forums.phpfreaks.com/topic/119933-solved-unexpected-end-error/#findComment-617817 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.