Jump to content

syntax error in my code


Meg_Griffin

Recommended Posts

That's my code: <form method='POST' action='<?php echo $_SERVER['PHP_SELF'] ?>'> <p>Name <input name="name" /></p> <p>E-mail <input name="email" /></p> <button type="submit">Save</button></form> The output shows: Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\exercise_01\templates\students\register.php on line 5 When I got rid of this "<" nothing happened.

Link to comment
Share on other sites

Well,that is part of file register.php on my project. It's a small system using a DB. I don't know why specifically this file is not working properly. The others are working perfectly.on line 5 is <form method='POST' action='<?php echo $_SERVER['PHP_SELF'] ?>'>

Link to comment
Share on other sites

problem is here action='<?php echo $_SERVER['PHP_SELF'] ?>'> with "" and 'so in action either write "" out side and '' inside or viceversaaction = "<?php echo $_SERVER['PHP_SELF']; ?>"oraction = '<?php echo $_SERVER["PHP_SELF"]; ?>'

Link to comment
Share on other sites

rahultailwalmy full code: <h2>Register Student</h2> <?php //code to register student<form method='POST' action='<?php echo $_SERVER['PHP_SELF']; ?>'> <p>Name <input name="name" /></p> <p>E-mail <input name="email" /></p> <button type="submit">Save</button></form> <?php if (count($_POST) > 0){ insert($_POST, 'students'); ob_clean(); header('LOCATION: '.ROOT.'/students/list.php'); }?> ?>

Edited by Meg_Griffin
Link to comment
Share on other sites

Remove the following in red and see if you still get the error:<?php//code to register student<form method='POST' action='<?php echo $_SERVER['PHP_SELF']; ?>'><p>Name <input name="name" /></p><p>E-mail <input name="email" /></p><button type="submit">Save</button></form> <?phpif (count($_POST) > 0){insert($_POST, 'students');ob_clean();header('LOCATION: '.ROOT.'/students/list.php');}?> ?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...