0

Hi Guys!

I was wondering if anyone could shed some light on this problem.

I recently changed my login forms ugly default submit button to and image. The problem being that the image is submitting the form but I'm not getting the results I hoped for. It isn't logging me in or showing any other error messages e.g. Wrong password.

So I ran:

echo '<pre>';
print_r($_POST);
echo '</pre>';

Which gave my the following array after entering an example and clicking the submit image button:

Array
(
    [username] => test
    [password] => test
    [submit_x] => 64
    [submit_y] => 14
)

I was hoping someone could shed some light on my problem.

My PHP goes something like:

<?
if(isset($_POST['submit'])){
//LOGIN PHP CODE

}else{
// Show login form
}
?>

I know my PHP is alright as it works fine without an image button.

Thank you for any help in advance :)

Public-Image

3
Contributors
7
Replies
14
Views
6 Years
Discussion Span
Last Post by Zagga
0

Hi public-image,

This is a problem that affects IE and Firefox(4+) but for different reasons.

IE doesn't recognise the image button as a submit button, so no form data is send when the button is clicked.

Firefox doesn't send a name of the button field, just the x and y co-ordinates, so you can't check if a submit button has been clicked.

Your best bet is to use a standard submit button (which is what we should be using anyway) and style it nicely with CSS. A google search for 'css submit button' will give all the info you need.


Zagga

Edited by Zagga: n/a

0

No worries. It's fresh in my mind because I just converted all the buttons on my site for this very reason.

0

I believed I was just becoming a very rusty coder although that would be quite a kick in the chops due to the button part being HTML :)

0

hi. I am newbie at PHP programming. something makes me crazy since 2 days. I wanted to make a simply feedback form but i can not understand problem it does not work. i decided to make a really simple sample for test. I created 2 files. welcome.html and welcome.asp
welcome.html
<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>

and welcome.php
<html>
<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.

</body>
</html>
i have copied and pasted these codes from http://www.w3schools.com/php/php_forms.asp
i sent my pages into my server. but it never works
is there anyone who can help me? what can be problem here?

0

I think you are getting asp and php mixed up. Save welcome.asp as welcome.php instead and try that.

Also, you should really open a new post for your problem, instead of reopening a old solved thread.


Zagga

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.