FXC Posted August 31, 2008 Share Posted August 31, 2008 Hi guys, sup? I have this code: <?php require ("config.php"); $i=$_POST[submit]; if(isset($i)) { $ruser=$_POST[rusername]; $rpass=$_POST[rpassword]; $regcode2=$_POST[regcode]; if($regcode==$regcode2) { require("connect.php"); $ruser = mysql_real_escape_string($ruser); $rpass = mysql_real_escape_string($rpass); mysql_query("INSERT INTO users (user,pass,uploads,downloads,rep) VALUES ('$ruser','$rpass',0,0,0)") or die(mysql_error()); echo ("Succes!"); }else{ sleep(2); echo "Wrong register code! Try again or leave."; } } ?> <style type="text/css"> <!-- .style2 {color: #990033} --> </style> <form action="<?php echo htmlentities(strip_tags($_SERVER['SCRIPT_URL']));?>" method="post" name="form1" class="style2" id="form1"> <pre><label> Username: <input name="username" type="text" id="rusername" maxlength="12" /> Max. 12 characters </label>Password:<label> <input name="password" type="password" id="rpassword" maxlength="12" /> Max. 12 characters<br /></label>Registercode: <label><input type="text" name="regcode" id="regcode" /> Contact the admin for the code </label> <label><input type="submit" name="submit" id="submit" value="Register" /> </label> </pre> </form> What I want it to do is: Let the user choose a user name and password and then fill in a the regcode (just a pass so not everybody can register) Then I want to check if the form is send and so yes check the register code, connect to mysql and anti sql the input then put the input in the database. The problem is that the $ruser and $password are just empty in mysql and I can't seem to echo them. They just stay empty :| Where is it going wrong? Please help me guys, Thanks alot Don't know of it mathers but this page is included by my index page like: index.php?p=register Quote Link to comment Share on other sites More sharing options...
peranha Posted August 31, 2008 Share Posted August 31, 2008 $i=$_POST[submit]; if(isset($i)) { $ruser=$_POST[rusername]; $rpass=$_POST[rpassword]; $regcode2=$_POST[regcode]; Should be $i=$_POST['submit']; if(isset($i)) { $ruser=$_POST['username']; $rpass=$_POST['password']; $regcode2=$_POST['regcode']; Quote Link to comment Share on other sites More sharing options...
FXC Posted August 31, 2008 Author Share Posted August 31, 2008 Oh thanks allot I used the id for the variables in stead of the name, thanks for solving SOLVED 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.