jeppers Posted August 20, 2007 Share Posted August 20, 2007 i have been looking at this code for about an hour, when i load it up nothing shows up on the screen. i am sure it is simple but as you know he longer you look the hard it gets to spot the error.. <?php //reg.php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //set the page title ini_set ('TITLE', 'register'); //basic html formatting print '<div id="leftcontent"> <h1>Registration Form</h1> <p>Register so that you can take advantage of this, that and other things.</p>'; //check if the form has been submitted if (isset ($_POST['submit'])) { $problem = FALSE; // no problems so far //check each value if (empty ($_POST['username')) { $problem = TRUE; print '<p>Please enter your username</p>'; } if(empty ($_POST['first_name'])) { $problem = TRUE; print '<p>Plase 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</p>'; } if (empty($_POST['password1'])) { $problem = TRUE; print '<p>Please enter your 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 probles... print '<p>You are now registered!<br />Okey, you are not really registerd but...</p>'; }else { // forgoten field. print '<p>Please try again!</p>'; } }//end of handle for 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 />'; print 'Last Name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . '"/><br />'; print 'Email Address: <input type="text" name="email" size="20" value="' . $_POST['email'] . '"/><br />'; print 'Password: <input type="password" name="password1" size="20" /><br />'; print 'Confirm Password: <input type="password" name="password2" size="20" /><br />'; <input value="submit" name="submit" value="Register!" /></p> </form> //complete the html formatting stuff. print '</div>'; include ('templates/footer.php'); // need the footer ?> Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/ Share on other sites More sharing options...
trq Posted August 20, 2007 Share Posted August 20, 2007 This is incorrect.... //set the page title ini_set ('TITLE', 'register'); Im not sure what your trying to do, but ini_set is made for setting php configuration options. Maybe you meant... define('TITLE','register'); which defines a constant. Other than that, the only thing I can see is a few print statements missing. ie; <input value="submit" name="submit" value="Register!" /></p> </form> should be... print '<input value="submit" name="submit" value="Register!" /></p>'; print '</form>' Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-328873 Share on other sites More sharing options...
MadTechie Posted August 20, 2007 Share Posted August 20, 2007 ahh to slow.. Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-328875 Share on other sites More sharing options...
jeppers Posted August 21, 2007 Author Share Posted August 21, 2007 ok this problem must be with my apache server as you say nothing is wrong with it but on mine nothing happens so is there any idea on what it could be and what i could do with it thanks Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329814 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 ok this problem must be with my apache server as you say nothing is wrong with it but on mine nothing happens so is there any idea on what it could be and what i could do with it thanks WHAT!!!! read thorpe's post This is incorrect.... //set the page title ini_set ('TITLE', 'register'); Im not sure what your trying to do, but ini_set is made for setting php configuration options. Maybe you meant... define('TITLE','register'); which defines a constant. Other than that, the only thing I can see is a few print statements missing. ie; <input value="submit" name="submit" value="Register!" /></p> </form> should be... print '<input value="submit" name="submit" value="Register!" /></p>'; print '</form>' Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329816 Share on other sites More sharing options...
jeppers Posted August 21, 2007 Author Share Posted August 21, 2007 Ok done that but nothing it is very sad that this is stopping me from moving on, any more clues.. can u see if that code runs on your server please Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329820 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 this works fine (except for the lack of footer.php) fixed a few more errors <?php //reg.php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //set the page title define ('TITLE', 'register'); //basic html formatting print '<div id="leftcontent"> <h1>Registration Form</h1> <p>Register so that you can take advantage of this, that and other things.</p>'; //check if the form has been submitted if (isset ($_POST['submit'])) { $problem = FALSE; // no problems so far //check each value if (empty ($_POST['username'])) { $problem = TRUE; print '<p>Please enter your username</p>'; } if(empty ($_POST['first_name'])) { $problem = TRUE; print '<p>Plase 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</p>'; } if (empty($_POST['password1'])) { $problem = TRUE; print '<p>Please enter your 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 probles... print '<p>You are now registered!<br />Okey, you are not really registerd but...</p>'; }else { // forgoten field. print '<p>Please try again!</p>'; } }//end of handle for 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 />'; print 'Last Name: <input type="text" name="last_name" size="20" value="' . $_POST['last_name'] . '"/><br />'; print 'Email Address: <input type="text" name="email" size="20" value="' . $_POST['email'] . '"/><br />'; print 'Password: <input type="password" name="password1" size="20" /><br />'; print 'Confirm Password: <input type="password" name="password2" size="20" /><br />'; print '<input type="submit" value="submit" name="submit" value="Register!" /></p>'; print '</form>'; //complete the html formatting stuff. print '</div>'; include ('templates/footer.php'); // need the footer ?> Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329825 Share on other sites More sharing options...
jeppers Posted August 21, 2007 Author Share Posted August 21, 2007 Thanks i seen a few errors but not sure of all of them... the edited code you did works well and i thank you.. wish i new where i went wrong thanks Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329842 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 problems where read thorpe's post + if (empty ($_POST['username')) { //MISSING close ] //missing print ' '; ALSO MISSING TYPE <input value="submit" name="submit" value="Register!" /></p> Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329846 Share on other sites More sharing options...
jeppers Posted August 21, 2007 Author Share Posted August 21, 2007 I see it now thanks you have helped a lot...... Quote Link to comment https://forums.phpfreaks.com/topic/65821-solved-please-can-anyone-see-what-is-wrong-with-this/#findComment-329852 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.