POST method doesn't work, but GET does?

General discussions related to php

Moderators: macek, egami, gesf

lggarrison
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Jan 07, 2003 8:26 am
Contact:

POST method doesn't work, but GET does?

Postby lggarrison » Tue Jan 07, 2003 8:35 am

Hi everyone,

I have this weird problem. I created a script on my localhost and then moved it to the company webserver. It worked fine on my machine, but it screws up on the webserver.

The problem is if the form's method is set to POST and I submit the form, I get a 404 "This page cannot be found" -- even when the page is submitting to itself.

But if I change the form's method to GET, I have no problems.

Does anyone have any suggestions on what is causing this or how to solve it?

Thanks,

Lacy

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Tue Jan 07, 2003 9:10 am

Post that piece of code, so we can check for possible mistakes.
bye!

lggarrison
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Jan 07, 2003 8:26 am
Contact:

Postby lggarrison » Tue Jan 07, 2003 9:18 am

I simplified it to the bare minimum and I'm still having problems doing just this. Here are the two files.

=============================================

login.php

=============================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

<form method="post" action="index2.php">

<table>
<tr>
<td>Name:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td> <input type="password" name="password"></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="submit" value="Login"></td>
</tr>
</table>


</form>

</body>
</html>

============================================

index2.php

============================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>
<title>Content Database Management System -- Small Business Site</title>
</head>

<body>

<?php echo $username; ?><BR>
<?php echo $password; ?>

</body>
</html>

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Tue Jan 07, 2003 3:43 pm

Code: Select all

<?php echo $HTTP_POST_VARS["username"]; ?><BR>
<?php echo $HTTP_POST_VARS["password"]; ?>

try this one
bye!
;)

Hurkle
New php-forum User
New php-forum User
Posts: 36
Joined: Tue Jan 07, 2003 8:45 am
Location: Minnesota, USA

Postby Hurkle » Tue Jan 07, 2003 3:55 pm

depending on your settings, you might also get away with this:

Code: Select all

<?php echo  $_POST['username'] . "<BR>" . $_POST['password'] ;?>


lggarrison
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Jan 07, 2003 8:26 am
Contact:

Postby lggarrison » Wed Jan 08, 2003 6:46 am

Thanks for all of your help. It ended up being a server issue.

Lacy


Return to “PHP General”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest