pdenlinger Posted January 10, 2007 Share Posted January 10, 2007 My editor is returning this error in my code: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING What does this mean?Is there a place I can go to look up what these error codes in plain English?Thank you. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 That is english :-PPost the lines around where the error is, and we can help you find it.It means you left some php syntax out, such as forgetting to close a string or end a line with ;, etc. Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 /* Display the form. */print '<form action="register.php" method="post"><p>';print 'Username: <input type="text" name="username" size="20" value="' . $_POST['username'] . '" /><br />'; Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 10, 2007 Share Posted January 10, 2007 me thinks you need to escape you " so they read \" Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 No, the whole string is single quoted, so they're fine.I don't see any errors. Post more of the code and use the code tag (The #) Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 10, 2007 Share Posted January 10, 2007 [quote author=jesirose link=topic=121729.msg501036#msg501036 date=1168398908]No, the whole string is single quoted, so they're fine.I don't see any errors. Post more of the code and use the code tag (The #)[/quote]*pouts* Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 Hmmm....I'm inserting a screenshot of the error message from my editor; hope this helps.[img]http://file:///C:/Documents%20and%20Settings/Paul/Desktop/ErrorMessage.png[/img] Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted January 10, 2007 Share Posted January 10, 2007 We'd rather see more code, you already told us what the error is ;) Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 Yeah...Can you post the 10 lines surrounding the line the error points to? Quote Link to comment Share on other sites More sharing options...
DarkendSoul Posted January 10, 2007 Share Posted January 10, 2007 Umm actually i think the error is right there... try this instead[code]<?php/* Display the form. */print "<form action='register.php' method='post'><p>";print "Username: <input type='text' name='username' size='20' value='{$_POST['username']}' />";?>[/code]Before when $_POST['username'] was called i thought the first ' is where to start normal echoing, leaving just $_POST[ in php. Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted January 10, 2007 Share Posted January 10, 2007 No idea what you said darkened, my guess is a different culprit Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 His first two lines are fine, there isn't an error in there. Quote Link to comment Share on other sites More sharing options...
DarkendSoul Posted January 10, 2007 Share Posted January 10, 2007 Yeah i just checked... :\Anywho bed time.Jesi r robot girl. she doesnt need sleep Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 I have posted more lines of code surrounding the culprit area.--------------------------------------------------- if (!problem) {/* If there weren't any problems... */ print '<p>You are now registered!<br />Okay, you are not really registered but...</p>'; } else { /* Forgot a field. */ print '<p>Please try again!</p>;' /* End of handle form IF. */ /* Display the form. */print '<form action="register.php" method="post"><p>';print 'Username: <input type="text" name="username" size="20" value="' . $_POST['username'] . ' " /><br />';Last name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . ' " /><br />';Email address: <input type="text" name="username" size="20" value="' . $_POST['email'] . ' " /><br />';print 'Password: <input type="password" name="password1" size="20" /><br />Confirm Password: <input type="password" name="password2" size="20" /><br /><input type="submit" name="submit" value="Register!" /></p></form>'; Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 10, 2007 Share Posted January 10, 2007 Please edit your post and put the [nobbc][code] tag at the start and the [/code] tag at the end. This will make your code much easier to read. [/nobbc]Ken Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 if (!problem) {/* If there weren't any problems... */you're missing a $ sign.Use the code tags, and get an editor which does syntax highlighting. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 10, 2007 Share Posted January 10, 2007 You don't start these lines with either "print" or "echo":[code]<?phpLast name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . ' " />';Email address: <input type="text" name="username" size="20" value="' . $_POST['email'] . ' " />';?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 That too. Good eye Ken! Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 OK, here is the whole body of code with beginning and ending [code] tags.Thank you.-------------------------------------------------------------------------[code]<?php // Script 8.9 - register.php// This page lets people register for the site (sort of).// Address error handling.ini_set ('display_errors', 1);error_reporting (E_ALL & ~E_NOTICE);// Set the page title and include the header file.define ('TITLE', 'Register');require ('templates/header.html');// Basic HTML formatting stuff.print '<div id="leftcontent"> <h1>Registration Form</h1> <p>Register so that you can take advantage of certain features like this, that, and the other thing.</p>';// Check if the form has been submitted.if ( isset ($_POST['submit'])) { $problem = FALSE; // No problems so far. // Check for each value. if (empty ($_POST['username'])) { $problem = TRUE; print '<p>Please enter a username!</p>'; } if (empty ($_POST['first_name'])) { $problem = TRUE; print '<p>Please enter your first name!</p>'; } if (empty ($_POST['last_name'])) { $problem = TRUE; print '<p>Please enter your last name!</p>'; } if (empty ($_POST['email'])) { $problem = TRUE; print '<p>Please enter your email address!</p>'; } if (empty ($_POST['password1'])) { $problem = TRUE; print '<p>Please enter a password!</p>'; } if ($_POST['password1'] != $_POST['password2']) { $problem = TRUE; print '<p>Your password did not match your confirmed password!</p>'; } if (!$problem) { // If there weren't any problems... print '<p>You are now registered!<br />Okay, you are not really registered but...</p>'; } else { // Forgot a field. print '<p>Please try again!</p>'; }} // End of handle form IF.// Display the form.print '<form action="register.php" method="post"><p>';print 'Username: <input type="text" name="username" size="20" value="' . $_POST['username'] . '" /><br />';print 'First Name: <input type="text" name="first_name" size="20" value="' . $_POST['first_name'] . '" /><br />Last Name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . '" /><br />Email Address: <input type="text" name="email" size="20" value="' . $_POST['email'] . '" /><br />';print 'Password: <input type="password" name="password1" size="20" /><br />Confirm Password: <input type="password" name="password2" size="20" /><br /><input type="submit" name="submit" value="Register!" /></p></form>';// Complete the HTML formatting stuff.print '</div>';require ('templates/footer.html'); // Need the footer.?>[/code][/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 Is there still a problem? Can you post the error with the line number? I don't see anything. [s]I thought true and false were case sensitive, but maybe not. I'll check.[/s] Nope, all looks fine to me. Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 Uploaded the code to my web server and am still getting the same error message on line 63 in my editor, and on the web server. The error reads "Parse error: syntax error, unexpected T_PRINT in register.php on line 63"Here is line 63:[code]print '<form action="register.php" method="post"><p>'; [/code] Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 10, 2007 Share Posted January 10, 2007 Are you sure that the source you posted here and the code you're getting the error in are the same? I took your code, put it on my server and commented out the two requires. No errors were display and the form was displayed. Can you post the source for the two required files?Ken Quote Link to comment Share on other sites More sharing options...
pdenlinger Posted January 10, 2007 Author Share Posted January 10, 2007 Here is the code for the header file:[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title><?php //Print the page title.if (defined('TITLE')) { //Is the title defined? print TITLE; } else { //The title is not defined. print 'Elliott Smith Fan Club'; }?></title><style type="text/css"> body { margin:0px 0px 0px 0px; background: #9F9; } #leftcontent { float:left; width:67%; background:#fff; border-right:2px solid #000; border-bottom:2px solid #000; margin-right:15px; padding-bottom:20px; } p,h1,pre { margin:0px 30px 10px 30px; } h1 { font-size:14px; padding-top:10px; } #rightcontent p { font-size:14px; margin-left:0px; }.linkback { position: absolute; width: 300px; height: 10px; right: 0; top: 0; z-index:1999; font: normal normal normal 10pt arial}.linkbacktitle { background:#333399; cursor:move; color:white; padding: 2px; font-weight: bold}.linkbackinner { border:1px solid #06060a; background:#efefff; text-align: left; opacity:0.85; }.linkbackinner ul { list-style-type: circle ; margin-left: 1px; padding-left: 15px}.linkbackinner li { margin-top: 1px; margin-bottom: 1px; margin-left: 1px; color: gray; }.linkbackinner a:link { color: #0000DD; }.linkbackinner a:visited { color: #AF00AF; }.linkbackinner a:hover { background-color: #ffcc99;}</style></head><body><!-- BEGIN CHANGEABLE CONTENT. --></body></html>[/code]Here is the code for the footer file:[code]<!-- END CHANGEABLE CONTENT. --><div id="rightcontent"> <h1>Navigation</h1> <p> <a href="index.php">Home</a><br /> <a href="albums.php">Discography</a><br /> <a href="login.php">Login</a><br /> <a href="register.php">Register</a><br /> </p> <p><em> <?php print date ('g:i a l F j' ); ?> </em></p></div><!-- Script 8.7 - footer.htm (Second version after Script 8.3--> </body></html>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.