CyberShot Posted October 18, 2009 Share Posted October 18, 2009 I have a simple form <label for="username" name="username">Username or email</label> <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text"> </p> <p> <label for="password" name="password">Password</label> <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password"> </p> <p class="clear"></p> <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a> <p class="remember"> <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit"> <input id="cancel_submit" value="Cancel" tabindex="7" type="button"> [/code the action is set for includes/handle_form.php and in the handle form, I am just trying to test that I can get the username and password and then echo out the results. Am I doing it wrong? [code] if(isset($_POST['submit'])){ $name = $_POST['username']; $pass = $_POST['password']; echo "$name ."". $pass"; } Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/ Share on other sites More sharing options...
mikesta707 Posted October 18, 2009 Share Posted October 18, 2009 i dont see any form tags. you have to wrap input and other form tags with <form></form> tags, like so <form method="post" > <label for="username" name="username">Username or email</label> <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text"> </p> <p> <label for="password" name="password">Password</label> <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password"> </p> <p class="clear"></p> <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a> <p class="remember"> <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit"> <input id="cancel_submit" value="Cancel" tabindex="7" type="button"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939035 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 Yea, I got all that, I just posted the essential stuff so that you wouldn't have to look through all of it. Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939036 Share on other sites More sharing options...
mikesta707 Posted October 18, 2009 Share Posted October 18, 2009 Hmm, ok well everything looks fine to me. what exactly happens when you try this. Blank page? try print_r-ing $_POST, and see if the values you expect to be in there are Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939038 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 nothing happens when I push the button. the password box just sits there like I never pushed the button. What's the best way to send the user to a new page if the button is pushed? Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939039 Share on other sites More sharing options...
mikesta707 Posted October 18, 2009 Share Posted October 18, 2009 um, you use a submit button to do that. but it appears as if you already have to submit button. post your whole form's code, but im going to sleep soon so if you don't have this solved by tommorow I can take a look at it again Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939043 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 <fieldset id="signin_menu"> <span class="message">Please verify your account before continue</span> <form method="post" id="signin" action="handle_form.php"> <label for="username" name="username">Username or email</label> <input id="username" name="username" value="" title="username" class="required" tabindex="4" type="text"> </p> <p> <label for="password" name="password">Password</label> <input id="password" name="password" value="" title="password" class="required" tabindex="5" type="password"> </p> <p class="clear"></p> <a href="change_password.php" class="forgot" id="resend_password_link">Forgot your password?</a> <p class="remember"> <input id="submit" value="Sign in" tabindex="6" name="submit" type="submit"> <input id="cancel_submit" value="Cancel" tabindex="7" type="button"> </p> </form> </fieldset> that is all the code. I have the doctype in the header.php with an include in the top of the index. with the form. then the footer.php included also. I have the php code for the form in the handle_form.php a simple test was all I was trying to do to make sure it was working. Then I was going to try to learn how to do the rest of the validation as the days go on. Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939044 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 I packaged up the whole thing. You can download it here http://www.photobyiris.com/login.zip I stripped out all the javascript and the code started working. as it is, the php don't work, but If I remove everything but the form code, the php starts working. Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939049 Share on other sites More sharing options...
mrMarcus Posted October 18, 2009 Share Posted October 18, 2009 // I dont want this form be submitted $("form#signin").submit(function() { return false; }); this comment i found in your code pretty much explains your problem. remove it or just change false to true; Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939130 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 well, I deleted that bit of code becuase it doesn't really need to be there. The submit buttons works now but I still can not get anything out of the php code. I tried just a simple one <?php if(isset($_POST['submit'])){ header('location: newpage.php'); } ?> it just throws a # sign onto the end of the address Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939174 Share on other sites More sharing options...
CyberShot Posted October 18, 2009 Author Share Posted October 18, 2009 well, now it's working. Not sure what I did, but I am getting the page I need. Thanks for the help guys Quote Link to comment https://forums.phpfreaks.com/topic/178091-solved-help-with-a-simple-form/#findComment-939178 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.