bigboss Posted March 31, 2009 Share Posted March 31, 2009 Hi, I am trying to get a registration page to echo back values already added the form if one of the values is correct or a user forgets to add a value. I have tried using Value=" " but my variables are under my form code, so they can't be seen. I was just wondering if anyone had a way of returning values without using $_GET. Thanks. Quote Link to comment Share on other sites More sharing options...
9911782 Posted March 31, 2009 Share Posted March 31, 2009 send me your code please.. thanks Quote Link to comment Share on other sites More sharing options...
bigboss Posted March 31, 2009 Author Share Posted March 31, 2009 Anyone? I can dump my code here, however there are a lot of functions diffrent pages called. Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 31, 2009 Share Posted March 31, 2009 post the form Quote Link to comment Share on other sites More sharing options...
bigboss Posted March 31, 2009 Author Share Posted March 31, 2009 Form as requested <?php session_start(); if(!empty($_SESSION['logedin'])) { header("Location: controlpanel.php"); } ?> <!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=utf-8" /> <title>Register</title> <link href="css/joinery.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script> <script type="text/javascript" src="js/lightbox.js"></script> </head> <body> <div class="header"> <div class="nav"> <a href="index.php">Home</a> | <a href="about.php">About</a> | <a href="products.php">Products</a> | <a href="contact.php">Contact</a> | <a href="location.php">Location</a> </div> <div class="login"> <a href="login.php">Login</a> / <a href="register.php">Register</a> </div> </div> <div class="background"> <div class="title">Register</div> <div class="content"> <em>All fields marked with a asteriks (*) are mandatory.</em> <br/> <br/> <form id="register" name="register" action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <table width="400"> <tr> <td width="248">* Username:</td> <td width="200"><input name="username" type="text" maxlength="20"></td> </tr> <tr> <td> * Password:</td> <td><input name="password" type="password" maxlength="20"></td> </tr> <tr> <td> * Retype Password:</td> <td><input name="repassword" type="password" maxlength="20"></td> </tr> <tr> <td>* Email Address:</td> <td><input name="email" type="text" maxlength="127"></td> </tr> <tr> <td>* Retype Email Address:</td> <td><input name="reemail" type="text" maxlength="127"></td> </tr> <tr> <td>* First Name:</td> <td><input name="first_name" type="text" maxlength="50" /></td> </tr> <tr> <td>* Last Name:</td> <td><input name="last_name" type="text" maxlength="50"></td> </tr> <tr> <td>* Address Line 1:</td> <td><input name="address1" type="text" maxlength="50"></td> </tr> <tr> <td> Address Line 2:</td> <td><input name="address2" type="text" maxlength="50"></td> </tr> <tr> <td>* Town/City:</td> <td><input name="towncity" type="text" maxlength="50"></td> </tr> <tr> <td>* Postcode:</td> <td><input name="postcode" type="text" maxlength="20" value=""></td> </tr> <tr> <td> Telephone Number: <br /></td> <td><input name="telephone" type="text" maxlength="11"></td> </tr> </table> <br/> <em>Please enter the security code to the left.</em> <br/> <table width="400"> <tr> <td width="248"><img src="captcha.php"/></td> <td width="200"><input name="captcha" type="text" maxlength="6" /></td> </table> <br/> <input type="submit" value="Register" name="submit" /> </form> <?php if(isset($_POST['submit'])){ include 'config.php'; #Database connection info. include 'functions/functions.php'; #Functions page. /*Declare variables to hold values returned by validate() or hold errors.*/ $errors = array(); $username = validate('username','username',1); $password = validate('password','password',1); $email = validate('email','email',1); $first_name = validate('first_name','name',1); $last_name = validate('last_name','name',1); $address1 = validate('address1','address',1); $address2 = validate('address2','address',0); $towncity = validate('towncity','address',1); $postcode = validate('postcode','postcode',1); $telephone = validate('telephone','telephone',0); validate('captcha','captcha',1); /*mySQL for inserting or checking duplicate usernames or emails*/ $insert_query = "INSERT INTO users (username, password, email, first_name, last_name, address_line1, address_line2, town_city, postcode, telephone_number) VALUES('$username', '$password', '$email', '$first_name', '$last_name', '$address1', '$address2', '$towncity', '$postcode', '$telephone')"; if(sizeof($errors) > 0){ foreach ($errors as $index => $value){ echo "<br/>" . ($errors[$index]); } } else { $insert = mysql_query($insert_query); echo "<br/> Thanks for registering, Click <a href='login.php'/>Here</a> to login."; } } ?> </div> </div> <div class="footer"> <div class="copyright"> <div align="center">© 2007 J and S Joinery<br /> </div> </div> </div> </body> </html> 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.