newbiestarter
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by newbiestarter
-
-
Hello. I'm new to this community and I have just recently started learning PHP.
I have run into the problem that the require statement doesn't seem to work:
HTML 1:phplesson23.tmpl.php
<!doctype html><html><head><style>li { list-style: none;}</style></head><body><h1>Join me in my journey to conquer the world!</h1><form action="" method="post"><?php if ( isset($status) ) echo $status; ?><ul><li><label for="name">Your name:</label><input type="text" name="name"></li><li><label for="email">Your email:</label><input type="text" name="email"></li><li><input type="submit" name="SIGN UP"></li></ul></form></body></html>
HTML 2: phplesson23.php
This is the one with the require statement.
<?php if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {$name = trim($_POST['name']);$email = trim($_POST['email']); if ( empty($name) || empty($email) ) {$status = 'Provide a name and valid email.'}} require 'phplesson23.tmpl.php';?>
What am I doing wrong?
'require' in PHP
in PHP
Posted
Thank you for the replies and I solved it. I tried running the require statement in a separate script and it worked fine so I looked over it for the 6th time and I realised there was no ';' at the end of 'Provide a name and valid email.'
I can't believe I missed it when it was such a simple problem. I checked this thing so many times yesturday.