Jump to content

Form POST help


NLT

Recommended Posts

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();
}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.