terryds Posted May 1, 2013 Share Posted May 1, 2013 (edited) Hello, all! I want to create a sign-up page, then i make signup.html and signup.php ...The signup html goes well, but the signup php doesn't.. Please check what's wrong with my code... signup.html <!DOCTYPE html><html><head><title>Sign Up Now!</title><link rel="stylesheet" type="text/css" href="signup.css" /></head><body><h1>Sign up now and get the gifts!<h1><h3>Type down your identity !</h3><form method="post" action="signup.php"><fieldset><legend>Sign Up</legend><label for="fname">First Name:</label><input type="text" id="fname" name="fname" /> <label for="lname">Last Name:</label><input type="text" id="lname" name"lname" /> <label for="email">Email</label><input type="text" id="email" name="email" /> <label for="country">Country</label><input type="text" id="country" name="country" /> <label for="gender">Gender</label><input id="gender" name="gender" type="radio" value="male">Male<input id="gender" name="gender" type="radio" value="female">Female <label for="reason">Why do you want to join us ?</label><textarea id="reason" name="reason"></textarea> <input type="submit" value="Sign Up!" name="submit" /></fieldset></form></body></html> signup.php <!DOCTYPE html><html><head><title>Thanks for signing up!</title></head><body><h2>Wait till the admin validates your account</h2><?php$name = $_POST['fname'] . " " . $_POST['lname'];$email = $_POST['email'];$country = $_POST['country'];$gender = $_POST['gender'];$reason = $_POST['reason']; echo 'Thanks for signing up, ' . $name . '';echo 'Those datas you input will be emailed to admin' . '';echo 'Name : ' . $name . '';echo 'Email : ' . $email . '<br/>';echo 'Country : ' . $country . '';echo 'Gender : ' . $gender . '';echo 'I join this because ' . $reason;?> </body></html> When i fill in the form, then submit them.. Then the signup.php appears and the output is below Wait till the admin validates your account Notice: Undefined index: lname in C:xampphtdocsphpsignup.php on line 9Thanks for signing up, aaaaThose datas you input will be emailed to adminName : aaaaEmail : aaaa@aa.comCountry : aaaaGender : maleI join this because i like it Please fix this... P.S. I run it in localhost Edited May 2, 2013 by terryds Link to comment Share on other sites More sharing options...
Ingolme Posted May 1, 2013 Share Posted May 1, 2013 The HTML of your form has a mistake in it. You should look for it. Link to comment Share on other sites More sharing options...
DrDev Posted May 1, 2013 Share Posted May 1, 2013 I see it, do I win a prize? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2013 Share Posted May 1, 2013 You do, go ahead and create a cookie for yourself. Link to comment Share on other sites More sharing options...
DrDev Posted May 1, 2013 Share Posted May 1, 2013 setcookie("Prize", "Chocolate Chip"); Link to comment Share on other sites More sharing options...
terryds Posted May 2, 2013 Author Share Posted May 2, 2013 (edited) Umm.. I just notice one mistake and it doesn't fix the problem... The code <h1>Sign up now and get the gifts!<h1> Should be <h1>Sign up now ad get the gifts!</h1> Can someone please tell where the problem is for me? Edited May 2, 2013 by terryds Link to comment Share on other sites More sharing options...
terryds Posted May 2, 2013 Author Share Posted May 2, 2013 Solved !!!I have found one more mistake and it solved the problem !! This code doesn't have the equal sign... name"lname" Hahahah... I feel so ashamed.. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 2, 2013 Share Posted May 2, 2013 Things like this are pretty easy to solve, you just have to believe what the computer says. It's telling you that there isn't an item called "lname" (although that's the only error, so it found everything else), so you just need to look at that lname field to figure out why it can't find only that one. Glad you caught it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now