runnerjp Posted May 16, 2007 Share Posted May 16, 2007 hey guys.... at the moment i use a $content script so the content is displayed on a layout page where i want it... so i used this <?php $content="login/register.php"; include("include/header.inc.php"); include("include/body.inc.php"); ?> to display the layout... so header has my logo bit and body is the body layout.... $content is what file the content is going to be so below is the script in "login/register.php" <? include("login/include/session.php"); ?> <? /** * The user is already logged in, not allowed to register. */ if($session->logged_in){ echo "<h1>Registered</h1>"; echo "<p>We're sorry <b>$session->username</b>, but you've already registered. " ."<a href=\"index.php\">Main</a>.</p>"; } /** * The user has submitted the registration form and the * results have been processed. */ else if(isset($_SESSION['regsuccess'])){ /* Registration was successful */ if($_SESSION['regsuccess']){ echo "<h1>Registered!</h1>"; echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, " ."you may now <a href=\"main.php\">log in</a>.</p>"; } /* Registration failed */ else{ echo "<h1>Registration Failed</h1>"; echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, " ."could not be completed.<br>Please try again at a later time.</p>"; } unset($_SESSION['regsuccess']); unset($_SESSION['reguname']); } /** * this is area where users fill out there form */ else{ ?> <h1>Register</h1> <? if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form action="login/process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subjoin" value="1"> <input type="submit" value="Join!"></td></tr> <tr><td colspan="2" align="left"><a href="main.php">Back to Main</a></td></tr> </table> </form> <? } ?> The form itself displays in the body fine but when an error is put it then all the information is displayed below the body... i hope i have explained this so you understand... ty Quote Link to comment https://forums.phpfreaks.com/topic/51644-solved-need-lil-help-guys/ Share on other sites More sharing options...
jitesh Posted May 16, 2007 Share Posted May 16, 2007 Make like this <form action="login/process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <? if($form->num_errors > 0){ echo "<tr><td colspan=3><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td></tr>"; } ?><tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subjoin" value="1"> <input type="submit" value="Join!"></td></tr> <tr><td colspan="2" align="left"><a href="main.php">Back to Main</a></td></tr> </table> </form>[/Quote] Quote Link to comment https://forums.phpfreaks.com/topic/51644-solved-need-lil-help-guys/#findComment-254400 Share on other sites More sharing options...
runnerjp Posted May 16, 2007 Author Share Posted May 16, 2007 doh that was tad simply lol cheers mate for fast reply Quote Link to comment https://forums.phpfreaks.com/topic/51644-solved-need-lil-help-guys/#findComment-254404 Share on other sites More sharing options...
MadTechie Posted May 16, 2007 Share Posted May 16, 2007 Fast reply yes.. please click SOLVED Quote Link to comment https://forums.phpfreaks.com/topic/51644-solved-need-lil-help-guys/#findComment-254456 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.