NLT Posted April 2, 2012 Share Posted April 2, 2012 Ok so I've got trouble with a form I'm creating, I've got this: <form id="login" name="login" action="URL" method="post"> and then Input fields like: <input tabindex="3" type="text" class="login-field" name="acc.username" id="login-username" value="" maxlength="48"/> Now, if I go and submit that, and on the "URL" page I've had it echo $_POST['acc.username'] but it doesn't echo anything. I think it may be a problem with the form itself.. although I can't see one. The code I got for URL: <?PHP include('global.php'); if(isset($_POST['acc.username'])) { echo "lol"; } else { echo mysql_error(); } ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 2, 2012 Share Posted April 2, 2012 your form action is not set to post, it is set to URL which I have never even seen, pretty sure that's not valid. post and get are valid. (get is the ones in the url, post are hidden). Quote Link to comment Share on other sites More sharing options...
batwimp Posted April 2, 2012 Share Posted April 2, 2012 Action is the name of the file where the form is sent. So right now it is being sent to a file named "URL". Is this the behavior you wanted? Is your web server (apache, etc) set up to process files that don't have an extension? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 2, 2012 Share Posted April 2, 2012 your form action is not set to post, it is set to URL which I have never even seen, pretty sure that's not valid. post and get are valid. (get is the ones in the url, post are hidden). That's what I get for skimming. Plus the method was on the next line. thanks for correcting this. Quote Link to comment Share on other sites More sharing options...
NLT Posted April 2, 2012 Author Share Posted April 2, 2012 I forgot to mention - URL was a URL to a valid link Anyways, I just removed the .'s and now they work. Now I've come across another error checking if it has been submitted with isset(). Part of the form for submit: <input type="submit" name="loginbuttonnlol" value="Login" /> Then in the URL link I've got this: if (isset($_POST['loginbuttonnlol'])){ echo "lolol logged in"; } else { echo "lolno.jpg"; } But when I click "Login" it displays "lolno.jpg" as if it isn't been submitted. EDIT: URL == mywebsite.com/login.php Quote Link to comment Share on other sites More sharing options...
NLT Posted April 2, 2012 Author Share Posted April 2, 2012 Still getting the problem.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 2, 2012 Share Posted April 2, 2012 on your page do a print_r($_POST); Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 Array ( [credentialsusername] => sdg [credentialspassword] => dgdg ) :-\ Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 You're not doing anything else before that? Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 On the page I'm trying to get it from, this is all I have got: <?PHP include('global.php'); print_r($_POST); ?> Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 I don't know if this would help.. but.. <input type="submit" value="Login" class="login-top-button" name="loginbuttonnlol" id="login-submit-button"/> That's my login button and it's in the <form> element. Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 I have no idea at this point. Do you have a link? Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 I've got it working now, but only if I click Enter rather than clicking the "Login" button which I find very weird. EDIT: Actually, it always seemed it was that.. but why won't the submit button work? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 I'm curious what browser/OS are you using? Someone said something on another thread about the submit button not always being processed into POST, I am curious if this related. I have never heard of that before. Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 I'm curious what browser/OS are you using? Someone said something on another thread about the submit button not always being processed into POST, I am curious if this related. I have never heard of that before. Windows 7. Google Chrome. Although, I do have this code also for the Login button, I don't know if it may be causing it but.. <a href="lol.php" tabindex="5" id="login-submit-new-button"><span>Login</span></a> Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 Are you saying you are clicking that instead of the button? Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 Are you saying you are clicking that instead of the button? The code I posted is the text for the button, but I'm pretty confused on how it all works together. http://pastebin.com/T9gV02ui Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 Link didn't work. your <input> with a type="submit" (or "button") will be a submit button. An <a> element is a link. I;'m confused on what your form looks like all together. Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 Link didn't work. your <input> with a type="submit" (or "button") will be a submit button. An <a> element is a link. I;'m confused on what your form looks like all together. Sorry about that - I set it to 10 minutes. http://pastebin.com/22Ae1APr Quote Link to comment Share on other sites More sharing options...
NLT Posted April 3, 2012 Author Share Posted April 3, 2012 Anybody? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 4, 2012 Share Posted April 4, 2012 I don't get why you have a link and a button. Apparently in IE <8, if you hit enter instead of clicking the button it does not post the button. Check if one of your other values is submitted instead of the button. Quote Link to comment Share on other sites More sharing options...
NLT Posted April 4, 2012 Author Share Posted April 4, 2012 Then, how would I go about adding the things for the a href(class, id and things) to the submit button? Quote Link to comment Share on other sites More sharing options...
NLT Posted April 4, 2012 Author Share Posted April 4, 2012 What I need to do is to check if the login and password has been submit.. rather than all this playing, is there a way to add a hidden field as a submit or something? Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 4, 2012 Share Posted April 4, 2012 1. I would check if those two fields are submitted. 2. Yes you can add a hidden input. 3. you add a class and id to a button the same way you do to an <a>. Quote Link to comment Share on other sites More sharing options...
NLT Posted April 4, 2012 Author Share Posted April 4, 2012 1. I would check if those two fields are submitted. 2. Yes you can add a hidden input. 3. you add a class and id to a button the same way you do to an <a>. I just added a hidden field and now it works fine. Thank you for your help though, much appreciated. 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.