renlfey Posted October 14, 2009 Share Posted October 14, 2009 K guys im new here and in need of a quick fix! im getting Undefined index: success error and here is my code!! <?php if($_get["success"] == "1") { echo "Thank you for registering, Your browser will soon be redirected our home page!"; } else { include("../includes/RegistrationForm.php"); } ?> Any input would be greatly apreciated! Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted October 14, 2009 Share Posted October 14, 2009 change it to $_GET["success"] == "1" Quote Link to comment Share on other sites More sharing options...
renlfey Posted October 14, 2009 Author Share Posted October 14, 2009 o i tried <?php if $_GET["success"] == "1" { echo "Thank you for registering, Your browser will soon be redirected our home page!"; } ----------------------------------------- <?php $_GET["success"] == "1" { echo "Thank you for registering, Your browser will soon be redirected our home page!"; } -------------------------------------------------------------------------<?php if $_GET["success"] == "1"; { echo "Thank you for registering, Your browser will soon be redirected our home page!"; } And im still getting the error any way you can elaborate??? Thx for you quick response! Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted October 14, 2009 Share Posted October 14, 2009 Is there a success being set? I am guessing that you are using a form and sending success as a variable of the form. If not, you need something like if(isset($_GET['success']) && $_GET['success'] == "1") { echo "Thank you for registering, Your browser will soon be redirected our home page!"; }else{ echo "Error"; } Can you show your form as I am guessing you are not setting $_GET['success'] anywhere Quote Link to comment Share on other sites More sharing options...
renlfey Posted October 14, 2009 Author Share Posted October 14, 2009 Success!! Genious i cant beleive i didnt think of that ! The form <form action=register.php method=post> Username:<input name="username" size="30" autocomplete="off" value="" type="text" /><br /><br /> Password:<input name="password" size="30" type="password" /><br /><br /> First Name:<input name="firstname" size="30" type="text" /><br /><br /> Last Name:<input name="lastname" size="30" type="text" /><br /><br /> Email:<input name="email" size="30" type="text" /><br /><br /> Age:<input name="age" size="30" maxlength="2" /><br /><br /> <input type="submit" class="button" value="Register" /> <input type="reset" name="reset" value="Clear" /> </form> -------------------------------------------------------- the register.php <?php include 'mysql-connect.php'; $username = $_POST['username']; $password = $_POST['password']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ip = $_SERVER['REMOTE_ADDR']; $result = mysql_num_rows(mysql_query("SELECT * FROM wwd_users WHERE username='$username'")); if($result == 1) { echo " <script>window.location=\"registration.php?success=0\"</script>"; } else { mysql_query("INSERT INTO wwd_users (username, password, firstname, lastname, age, ip) VALUES ('$username', '$password', '$firstname', '$lastname', '$age', '$ip')"); echo " <script>window.location=\"registration.php?success=1\"</script>"; } ?> -------------------------------------------------------------------- Thanks again seems to work now Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted October 14, 2009 Share Posted October 14, 2009 this is where success is set registration.php?success=1 Quote Link to comment Share on other sites More sharing options...
renlfey Posted October 14, 2009 Author Share Posted October 14, 2009 Ive set it but i think it still needed to be set in the <?php if(isset($_GET['success']) && $_GET['success'] == "1") { echo "Thank you for registering, Your browser will soon be redirected our home page!"; } else { include("../includes/RegistrationForm.php"); } ?> In order for it to be defined stince im its being set from another page! either way weve tested it and its the perfect solution! Thanks again 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.